Skip to main content Skip to navigation

Creating a folder

Creating a new folder in a Files.Warwick filespace can be achieved by sending an HTTP POST to the Create Folder API. For example, to create a folder in the filespace: https://files.warwick.ac.uk/sarah, we can send a POST to:

curl -i -X POST -u externalusercode "https://files.warwick.ac.uk/files/api/createfolder?forceBasic=true&path=sarah/Files&folderName=newFolder"

Note that only the path to the filespace/folder is specified - not the entire URL.


jo-dev-oracle$ curl -i -X POST -u externalusercode "https://files.warwick.ac.uk/files/api/createfolder?forceBasic=true&path=sarah/Files&folderName=newFolder"
Enter host password for user 'externalusercode':
HTTP/1.1 200 OK
Date: Wed, 21 Nov 2012 11:14:46 GMT
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
Pragma: No-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache
Cache-Control: no-store
Content-Language: en-GB
Content-Length: 0
Set-Cookie: hashTag=""; Domain=.warwick.ac.uk; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/
Vary: User-Agent
Content-Type: text/plain

N.B. If the folder creation has been successful, a 200 will be returned (as above). A 500 HTTP Response will be returned in case of error, with some explanatory error in the response text (e.g. a folder already exists with that name at that location).

Important: Because of the way that HTTP Basic authentication sends an encrypted version of the username and password with every request, it is less secure than standard authentication through web sign-on. As well as this, by their very nature, automated programs require username and passwords to be stored on a computer in such a way that it would be a breach of the Terms and Conditions of IT Services accounts to store your actual ITS usercode and password in this way.

For automated systems that access Sitebuilder APIs, you must use an external user account for API access. You should not share an API account between multiple systems, and you should ensure that each account is granted the minimal permissions it needs to perform its tasks, and only on the pages where it needs to perform these tasks.


Getting an external user account for API access

In order to obtain an external user account for API access, please email webteam at warwick dot ac dot uk