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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

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

cbaurand
12-Amethyst

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.

ACCEPTED SOLUTION

Accepted Solutions
cbaurand
12-Amethyst
(To:nmilleson)

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

cbaurand
12-Amethyst
(To:nmilleson)

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


Top Tags