cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How can i use webservice to create a folder in a thingworx repository?

cbaurand
9-Granite

How can i use webservice to create a folder in a thingworx repository?

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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!

View solution in original post

2 REPLIES 2

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!

Announcements