Folders operations
Get a collection of folders
To get all folders, you must execute a GET request to the following endpoint:
{baseurl}/api/default/folders
Sample request
GET
http://mysite.com/api/default/folders
Sample response
Status code: 200 OK
{
"@odata.context": "http://localhost:1337/api/default/$metadata#folders(Id,LastModified,UrlName,Title,Description,RootId,ParentId,CoverId,ChildrenCount,Breadcrumb)",
"value": [
{
"Id": "43d06f6a-513f-4014-a707-f2da1b10844f",
"LastModified": "2021-04-19T13:32:15Z",
"UrlName": "cats-library",
"Title": "Cats library",
"Description": "",
"RootId": "80c3b126-cd64-4044-abc3-227043c8be20",
"ParentId": null,
"CoverId": null,
"ChildrenCount": 0,
"Breadcrumb": [
{
"Title": "Animals Library",
"FolderId": "80c3b126-cd64-4044-abc3-227043c8be20"
}
]
},
{
"Id": "7dff9bd1-518a-42eb-a985-7d1954f47804",
"LastModified": "2021-04-21T08:34:02Z",
"UrlName": "large-documents",
"Title": "Large documents",
"Description": "",
"RootId": "13f352fe-5bcc-4374-a234-0376f68bebc0",
"ParentId": null,
"CoverId": null,
"ChildrenCount": 0,
"Breadcrumb": [
{
"Title": "Samples",
"FolderId": "13f352fe-5bcc-4374-a234-0376f68bebc0"
}
]
},
{
"Id": "ad6bbe51-bdcb-4c15-9625-8fa1b0f0ad66",
"LastModified": "2021-04-21T08:30:09Z",
"UrlName": "very-large-videos",
"Title": "Very large videos",
"Description": "",
"RootId": "d4e22033-7bcd-4ce5-9c70-41f9b83d7d66",
"ParentId": null,
"CoverId": null,
"ChildrenCount": 0,
"Breadcrumb": [
{
"Title": "Sample videos",
"FolderId": "d4e22033-7bcd-4ce5-9c70-41f9b83d7d66"
}
]
}
]
}
NOTE: This endpoint serves all folders that are not root level libraries, regardless of whether the folder is nested inside an image album, video library, or a document library.
Get a folder
To get a single folder, you must execute a GET request to the following endpoint:
{baseurl}/api/default/folders({id})
Where id is the ID of the folder that you want to get, for example – 43d06f6a-513f-4014-a707-f2da1b10844f.
Sample request
GET
http://mysite.com/api/default/folders(43d06f6a-513f-4014-a707-f2da1b10844f)
Sample response
Status code: 200 OK
{
"@odata.context": "http://mysite.com/api/default/$metadata#folders/$entity",
"Id": "43d06f6a-513f-4014-a707-f2da1b10844f",
"LastModified": "2021-04-19T13:32:15Z",
"UrlName": "cats-library",
"Title": "Cats library",
"Description": "",
"RootId": "80c3b126-cd64-4044-abc3-227043c8be20",
"ParentId": null,
"CoverId": null,
"Provider": "OpenAccessDataProvider",
"ChildrenCount": 0,
"Breadcrumb": [
{
"Title": "Animals Library",
"FolderId": "80c3b126-cd64-4044-abc3-227043c8be20"
}
]
}
Create a folder
To create a folder, you must execute a POST request to the following endpoint:
{baseurl}/api/default/folders
The minimal requirements to create a folder are the Title and the RootId. The UrlName is not required by the API. If left unpopulated, it will be generated by the server as a random GUID.
Sample request
POST
http://mysite.com/api/default/videolibraries
Request body
{
"Title": "Folder title",
"RootId": "d4e22033-7bcd-4ce5-9c70-41f9b83d7d66"
}
Sample response
Status code: 200 OK
{
"@odata.context": "http://mysite.com/api/default/$metadata#folders/$entity",
"Id": "288eff11-6e67-48ae-aefc-45b1c97e898b",
"LastModified": "2021-04-27T13:30:20Z",
"UrlName": "86e4705e-3412-4558-a938-71b03e365992",
"Title": "Folder title",
"Description": "",
"RootId": "d4e22033-7bcd-4ce5-9c70-41f9b83d7d66",
"ParentId": null,
"CoverId": null,
"Provider": "OpenAccessDataProvider",
"ChildrenCount": 0,
"Breadcrumb": [
{
"Title": "New library",
"FolderId": "477045b1-56f3-4abf-8799-33d42813636f"
}
]
}
Partially update a folder
Updating a folder can be done in two ways – with a PATCH or with a PUT request. The difference between the two verbs is that PATCH allows for a partial update, whereas PUT requires all fields to be present in the request’s body.
To partially update a folder, you must execute a PATCH request to the following endpoint:
{baseurl}/api/default/folders({id})
Where id is the ID of the folder that you want to get, for example – 43d06f6a-513f-4014-a707-f2da1b10844f.
Sample request
PATCH
http://mysite.com/api/default/videolibraries(288eff11-6e67-48ae-aefc-45b1c97e898b)
Request body
{
"Title":"Edited folder title"
}
Sample response
Status code: 204 No Content
No response body
Fully update a folder
Updating a folder can be done in two ways – with a PATCH or with a PUT request. The difference between the two verbs is that PATCH allows for a partial update, whereas PUT requires all fields to be present in the request’s body.
To partially update a folder, you must execute a PUT request to the following endpoint:
{baseurl}/api/default/folders({id})
Where id is the ID of the folder that you want to get, for example – 43d06f6a-513f-4014-a707-f2da1b10844f.
Sample request
PUT
http://mysite.com/api/default/videolibraries(288eff11-6e67-48ae-aefc-45b1c97e898b)
Request body
{
"Title":"Edited folder title",
"Description":"Added description.",
"CoverId": null
}
Sample response
Status code: 204 No Content
No response body
Delete folder
To delete a folder, you must execute a DELETE request to the following endpoint:
{baseurl}/api/default/folders({id})
Where id is the ID of the folder that you want to get, for example – 43d06f6a-513f-4014-a707-f2da1b10844f.
Sample request
DELETE
http://mysite.com/api/default/videolibraries(288eff11-6e67-48ae-aefc-45b1c97e898b)
Sample response
Status code: 204 No Content
No response body