* Add Quickstart Guide * Update installation * Remove unused files * Update support/backing * Tweaks in concepts * Setup file structure for API reference 2.0 * Setup page layout for reference * Add clean-urls plugin * getting started updates * Finish authentication rest * getting started updates * Render stylus in 2 spaces * Various * Various * Finish activity docs * Add collections reference * Add extension reference * concepts updates * Fields/tweaks * Add files doc * Add revisions * concepts docs * More api reference * Finish rest api reference (finally) * initial concepts * More things * Add assets api ref * Move sections from file to assets * Add environment variables * contributing docs * Add field transforms page * Left align table headers * concept links * Add API config * Fix mobile nav * Add migrating a project * doc link fixes Co-authored-by: Ben Haynes <ben@rngr.org>
3.7 KiB
pageClass
| pageClass |
|---|
| page-reference |
Folders
Folders can be used to organize files. Folders are virtual, and aren't mirrored on the storage adapter.
The Folder Object
id uuid
Primary key of the folder.
name string
Name of the folder.
parent many-to-one
Parent folder. Many-to-one to folders (recursive).
{
"data": {
"id": "fc02d733-95b8-4e27-bd4b-08a32cbe4e66",
"name": "Test",
"parent": null
}
}
List Folders
List all folders that exist in Directus.
Query Parameters
Supports all global query parameters.
Returns
An array of up to limit folder objects. If no items are available, data will be an empty array.
GET /folders
// Response
{
"data": [
{
"id": "fc02d733-95b8-4e27-bd4b-08a32cbe4e66",
"name": "Test",
"parent": null
},
{...},
{...}
]
}
Retrieve a Folder
List all folders that exist in Directus.
Query Parameters
Supports all global query parameters.
Returns
Returns a folder object if a valid primary key was provided.
GET /folders/:id
// Response
{
"data": {
"id": "fc02d733-95b8-4e27-bd4b-08a32cbe4e66",
"name": "Test",
"parent": null
}
}
Create a Folder
Create one or more new virtual folder(s).
Query Parameters
Supports all global query parameters.
Request Body
A partial folder object or an array of partial folder objects. name is
required.
Returns
Returns the folder object of the folder that was created.
POST /folders
// Request
{
"name": "Test"
}
// Response
{
"data": {
"id": "fc02d733-95b8-4e27-bd4b-08a32cbe4e66",
"name": "Test",
"parent": null
}
}
Update a Folder
Update an existing folder.
Query Parameters
Supports all global query parameters.
Request Body
A partial folder object.
Returns
Returns the folder object of the folder that was updated.
PATCH /folders/:id
// Request
{
"parent": "d97c2e0e-293d-4eb5-9e1c-27d3460ad29d"
}
// Response
{
"data": {
"id": "fc02d733-95b8-4e27-bd4b-08a32cbe4e66",
"name": "Test",
"parent": "d97c2e0e-293d-4eb5-9e1c-27d3460ad29d"
}
}
Delete a Folder
Delete an existing folder.
::: tip Files
Any files in this folder will be moved to the root folder.
:::
Returns
Empty body.
DELETE /folders/:id
// Empty Response
Delete Multiple Folders
Delete multiple existing folders.
::: tip Files
Any files in these folders will be moved to the root folder.
:::
Request Body
An array of folder primary keys.
Returns
Empty body.
DELETE /folders
// Request
["d97c2e0e-293d-4eb5-9e1c-27d3460ad29d", "fc02d733-95b8-4e27-bd4b-08a32cbe4e66"]
// Empty Response