Asset folders
Asset folders object
Defines all asset folders within a Kontent.ai environment.
last_modifiedrequired · string · read-only · date-time
ISO-8601
formatted date/time of the last change to the folder.
JSON
{
"folders": [
{
"id": "958001d8-2228-4373-b966-5262b5b96f71",
"name": "Downloads",
"codename": "downloads",
"external_id": "folder-with-downloadable-assets",
"folders": [
{
"id": "9ca927b6-6e4d-4d6b-81e3-ec5e8f7772a0",
"name": "Archives",
"codename": "archives",
"external_id": "folder-with-downloadable-archives",
"folders": []
}
]
},
{
"id": "9ca927b6-6e4d-4d6b-81e3-ec5e8f7772a0",
"name": "Legal documents",
"codename": "legal_documents",
"external_id": "folder-documents",
"folders": []
}
],
"last_modified": "2019-08-08T08:16:24.3620957Z"
}Retrieve asset folders
Retrieve an array of all asset folders.
GET
https://manage.kontent.ai/v2/projects/{environment_id}/foldersRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Request samples
TypeScript
C#
cURL
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client.listAssetFolders().toPromise();
Response
Status (200)
All asset folders in the environment.
last_modifiedrequired · string · read-only · date-time
ISO-8601
formatted date/time of the last change to the folder.
Example responses
200
{
"folders": [
{
"id": "958001d8-2228-4373-b966-5262b5b96f71",
"name": "Downloads",
"codename": "downloads",
"external_id": "folder-with-downloadable-assets",
"folders": [
{
"id": "9ca927b6-6e4d-4d6b-81e3-ec5e8f7772a0",
"name": "Archives",
"codename": "archives",
"external_id": "folder-with-downloadable-archives",
"folders": []
}
]
},
{
"id": "9ca927b6-6e4d-4d6b-81e3-ec5e8f7772a0",
"name": "Legal documents",
"codename": "legal_documents",
"external_id": "folder-documents",
"folders": []
}
],
"last_modified": "2019-08-08T08:16:24.3620957Z"
}Add asset folders
Add one or more asset folders. If your environment already has folders, use modify asset folders instead.
POST
https://manage.kontent.ai/v2/projects/{environment_id}/foldersRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Body schema
Application/json
The asset folders to add.
Request samples
TypeScript
C#
cURL
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client
.addAssetFolders()
.withData({
folders: [
{
id: '958001d8-2228-4373-b966-5262b5b96f71',
name: 'Downloads',
codename: 'downloads',
external_id: 'folder-with-downloadable-assets',
folders: [
{
id: '9ca927b6-6e4d-4d6b-81e3-ec5e8f7772a0',
name: 'Archives',
codename: 'archives',
external_id: 'folder-with-downloadable-archives',
},
],
},
{
id: '9ca927b6-6e4d-4d6b-81e3-ec5e8f7772a0',
name: 'Legal documents',
external_id: 'folder-documents',
},
],
})
.toPromise();
Response
Status (201)
The created asset folders object.
last_modifiedrequired · string · read-only · date-time
ISO-8601
formatted date/time of the last change to the folder.
Example responses
201
400
{
"folders": [
{
"id": "958001d8-2228-4373-b966-5262b5b96f71",
"name": "Downloads",
"codename": "downloads",
"external_id": "folder-with-downloadable-assets",
"folders": [
{
"id": "9ca927b6-6e4d-4d6b-81e3-ec5e8f7772a0",
"name": "Archives",
"codename": "archives",
"external_id": "folder-with-downloadable-archives",
"folders": []
}
]
},
{
"id": "9ca927b6-6e4d-4d6b-81e3-ec5e8f7772a0",
"name": "Legal documents",
"codename": "legal_documents",
"external_id": "folder-documents",
"folders": []
}
],
"last_modified": "2019-08-08T08:16:24.3620957Z"
}Modify asset folders
Add, rename, or remove asset folders.
PATCH
https://manage.kontent.ai/v2/projects/{environment_id}/foldersRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Body schema
Application/json
The operations you want to perform on the folders.
array · unique items
Any of:
FolderOperationAddInto
oprequired · string · write-only
Specifies the operation to perform.
addIntoto add new foldersremoveto delete foldersrenameto rename folders
Accepted values:
addInto, rename, removereferenceobject
Reference to an existing folder under which you want to add new folders.
valuerequired · object
The folder you want to add.
afterobject
Reference to the existing folder after which you want to add the new folder.
The
after and before properties are mutually exclusive. If neither is specified, the object is added at the end.beforeobject
Reference to the existing folder before which you want to add the new folder.
The
after and before properties are mutually exclusive. If neither is specified, the object is added at the end.Request samples
Payload
TypeScript
C#
cURL
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client
.modifyAssetFolders()
.withData([
{
op: 'addinto',
value: {
external_id: 'folder-with-shared-assets',
codename: 'shared_assets',
name: 'Shared assets',
},
before: {
external_id: 'folder-with-downloadable-assets',
},
},
{
op: 'remove',
reference: {
external_id: 'folder-with-downloadable-archives',
},
},
{
op: 'rename',
value: 'Legal documents',
reference: {
codename: 'folder_documents',
},
},
])
.toPromise();
Response
Status (200)
The modified asset folders.
last_modifiedrequired · string · read-only · date-time
ISO-8601
formatted date/time of the last change to the folder.
Example responses
200
400
{
"folders": [
{
"id": "59aaaa55-1049-44bc-8785-0e327b271453",
"name": "Shared assets",
"external_id": "folder-with-shared-assets",
"folders": []
},
{
"id": "958001d8-2228-4373-b966-5262b5b96f71",
"name": "Downloads",
"external_id": "folder-with-downloadable-assets",
"folders": [
{
"id": "9ca927b6-6e4d-4d6b-81e3-ec5e8f7772a0",
"name": "Archives",
"external_id": "folder-with-downloadable-archives",
"folders": []
}
]
},
{
"id": "9ca927b6-6e4d-4d6b-81e3-ec5e8f7772a0",
"name": "Legal documents",
"external_id": "folder-documents",
"folders": []
}
],
"last_modified": "2022-03-27T13:21:11.38Z"
}