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.
folders[]required · array
All folders within a Kontent.ai environment.
Hide child attributes
external_idstring
The folder's external ID. Only present if specified via API when adding folders or modifying the
folders array to add new folders.folders[]array
Any folders contained within the given folder.
namerequired · string · 1-200 chars
The folder's name.
codenamestring · nullable · 1-60 chars
The folder's codename. The codename is always returned when retrieving asset folders. If the codename is not specified when adding an asset folder, it will be generated automatically. Using the asset folder's codename is optional when you add or modify an asset folder.
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
FolderOperationRemove
FolderOperationRename
FolderOperationAddInto
oprequired · string · write-only
Specifies the operation to perform.
addIntoto add new foldersremoveto delete foldersrenameto rename folders
referenceobject
Reference to a specific object in the environment.
The API uses internal IDs for referencing objects. This means that the reference objects in the API responses will always use internal IDs.
Show child attributes
valuerequired · object
Show child attributes
afterobject
Reference to a specific object in the environment.
The API uses internal IDs for referencing objects. This means that the reference objects in the API responses will always use internal IDs.
Show child attributes
beforeobject
Reference to a specific object in the environment.
The API uses internal IDs for referencing objects. This means that the reference objects in the API responses will always use internal IDs.
Show child attributes
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"
}