Managing folders
A folder is a file system container for other files and folders in a volume. The iHub system identifies a folder by a folder ID number, which is unique on each volume. The REST API uses file ID numbers for most requests. Users have explicit privileges to different folders. The /folders resource provides users access to files and folders, enables them to add, modify, or remove folders, and allows them to change folder privileges. iHub restricts these abilities based on a user’s privileges and access rights.
The following sections provide an example of using each folders resource as a curl command and detailed information about the response returned by the resource.
GET folders
This example requests the list of files and folders in the root folder of the volume, returning two items per response:
GET /ihub/v1/folders?fetchSize=2 HTTP/1.1
Host: myserver.mycompanyname.com:5000
AuthId: <authId>
This curl example requests the list of files and folders in the root folder of the default volume, returning two items per response:
curl -i http://%RESTHost%:5000/ihub/v1/folders ‑H "AuthId:%RESTAuthId%" ‑d fetchSize=2
GET folders/{folderId}
This example requests the details for the folder with the folder ID 640000000100:
GET /ihub/v1/folders/640000000100 HTTP/1.1
Host: myserver.mycompanyname.com:5000
AuthId: <authId>
This curl example requests the details of the folder with the folder ID 640000000100 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/folders/640000000100 ‑H "AuthId:%RESTAuthId%"
GET folders/{folderId}/items
This example requests the contents of the folder with the folder ID 640000000100 using the HTTPS protocol:
GET /ihub/v1/folders/640000000100/items HTTP/1.1
Host: myserver.mycompanyname.com:5010
AuthId=<authId>
This curl example requests the contents of the folder with the folder ID 640000000100 in the default volume:
curl -i https://%RESTHost%:5010/ihub/v1/folders/640000000100/items ‑H "AuthId:%RESTAuthId%"
GET folders/{folderId}/privileges
The following URI requests the privileges assigned to folder ID 340000000100 when accompanied by a GET method:
GET /ihub/v1/folders/340000000100/privileges HTTP/1.1
Host: myserver.mycompanyname.com:5010
AuthId=<authId>
This curl example requests the ACL for the folder with the folder ID 340000000100 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/folders/340000000100
/privileges ‑H "AuthId:%RESTAuthId%"
POST folders/{folderId}/privileges
The following HTTP request changes the privileges on the folder with folder ID 340000000100 for the mrfox user and the dahl user group:
POST /ihub/v1/folders/340000000100/privileges HTTP/1.1
Host: myserver.mycompanyname.com:5000
Content-Type: application/json; charset=utf-8
AuthId: <authId>
 
{Permission: [{"UserName":"mrfox", "AccessRight":"DEGRVW"}, {"UserGroupName":"dahl", "AccessRight":"RE"}]}
This curl POST request example changes the ACL of the folder with the folder ID 340000000100 to the ACL in foldersprivsparams.txt:
curl -i http://%RESTHost%:5000/ihub/v1/folders/340000000100‑X POST ‑H "AuthId:%RESTAuthId%" ‑H "Content-Type: application/json" ‑d "\{\"Permission":[\{\"UserName\":\"mrfox\",\"AccessRight\":
\"DEGRVW\"\},\{\"UserGroupName\":\"dahl\",\"AccessRight\":
\"RE\"\}]\}"
POST folders
This HTTP POST request example creates a new subfolder called Customers in the folder with the folder ID 340000000100:
POST /ihub/v1/folders HTTP/1.1
Host: myserver.mycompanyname.com:5000
content-type: application/x-www-form-urlencoded; charset=utf-8
AuthId: <authId>
 
name=Customers&parentFolderId=340000000100&description=Customer%20files
This curl POST request example creates a subfolder named Customers in the folder with the folder ID 340000000100 of the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/folders ‑X POST ‑H "AuthId:%RESTAuthId%" ‑d name=Customers ‑d parentFolderId=340000000100 ‑d description="Customer files"
DELETE folders/{folderId}
This example deletes the folder with the folder ID 70000000100:
DELETE /ihub/v1/folders/70000000100 HTTP/1.1
Host: myserver.mycompanyname.com:5000
Content-Type: application/json
AuthId: <authId>
This curl DELETE request example deletes the folder with the folder ID 70000000100 from the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/folders/70000000100 ‑X DELETE ‑H "AuthId:%RESTAuthId%"
PUT folders/{folderId}
The following HTTP request changes the name and path of the folder with folder ID 340000000100 to /Public/Application1:
PUT /ihub/v1/folders/340000000100 HTTP/1.1
Host: myserver.mycompanyname.com:5000
Content-Type: application/x-www-form-urlencoded
 
authId=<authId>&newName=%2FPublic%2FApplication1
This curl PUT request example changes the name and path of the folder with the folder ID 340000000100 to /Public/Application1 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/folders/340000000100 ‑X PUT ‑H "AuthId:%RESTAuthId%" ‑d newName=/Public/Application1