Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi ,
I want to create a folder in a thingworx repository to be able to upload a file in it.
I know how to upload a file, for example:
curl -v -H "X-XSRF-TOKEN: TWX-XSRF-TOKEN-VALUE" -H "AppKey: $APPKEY" \
-F "upload-repository=MyRepository" \
-F "upload-submit=Upload" \
-F "file=@myFile.tar.gz;type=application/x-zip-compressed" "$TWXURL/FileRepositoryUploader" \
-m 60 -f
I want to create a subfolder by the same way?
Thanks for your help.
Solved! Go to Solution.
In fact, upload creates automatically a folder if not exist:
curl -v -H "X-XSRF-TOKEN: TWX-XSRF-TOKEN-VALUE" -H "AppKey: $APPKEY" \
-F "upload-repository=MyRepository" \
-F "upload-path=MyNewFolder \
-F "upload-submit=Upload" \
-F "file=@myFile.tar.gz;type=application/x-zip-compressed" "$TWXURL/FileRepositoryUploader" \
-m 60 -f
This solution works fine!
The FileRepository ThingTemplate has a service called CreateFolder that you can call with the REST API. The only input to it is the path.
Hope that helps!
--Nick
In fact, upload creates automatically a folder if not exist:
curl -v -H "X-XSRF-TOKEN: TWX-XSRF-TOKEN-VALUE" -H "AppKey: $APPKEY" \
-F "upload-repository=MyRepository" \
-F "upload-path=MyNewFolder \
-F "upload-submit=Upload" \
-F "file=@myFile.tar.gz;type=application/x-zip-compressed" "$TWXURL/FileRepositoryUploader" \
-m 60 -f
This solution works fine!