Content items
- Using internal IDs:
<base_URL>/items/<content_item_id> - Using codenames:
<base_URL>/items/codename/<content_item_codename> - Using external IDs:
<base_URL>/items/external-id/<content_item_external_identifier>
<base_URL>/items/<content_item_id><base_URL>/items/codename/<content_item_codename><base_URL>/items/external-id/<content_item_external_identifier>https://manage.kontent.ai/v2/projects/{environment_id}/itemshttps://manage.kontent.ai/v2/projects/{environment_id}/items/{item_identifier}https://manage.kontent.ai/v2/projects/{environment_id}/itemshttps://manage.kontent.ai/v2/projects/{environment_id}/items/{item_identifier}https://manage.kontent.ai/v2/projects/{environment_id}/items/{item_identifier}environment_idThe content item to be added.
namecodenametypeidnamecodenameenvironment_iditem_identifieridnamecodenameenvironment_idx-continuationitems[]environment_iditem_identifierThe content item to update or create.
idnamecodenameenvironment_iditem_identifieridcodenameexternal_idcollectionsitemap_locations[]external_idtypeidcollectionspaces[]sitemap_locations[]external_idlast_modifiedtypeidcollectionspaces[]sitemap_locations[]external_idlast_modifiedpaginationnamecodenamecollectiontypeidcollectionspaces[]sitemap_locations[]external_idlast_modifiedsitemap_locations[]external_id property.name and can later be modified.name and can later be modified.335d17ac-b6ba-4c6a-ae31-23c1193215cb), external ID (e.g., external-id/custom-identifier-for-my-article), or codename (e.g., codename/my_article).name and can later be modified.x-continuation header parameter to the value of the continuation_token property.335d17ac-b6ba-4c6a-ae31-23c1193215cb), external ID (e.g., external-id/custom-identifier-for-my-article), or codename (e.g., codename/my_article).name and can later be modified.335d17ac-b6ba-4c6a-ae31-23c1193215cb), external ID (e.g., external-id/custom-identifier-for-my-article), or codename (e.g., codename/my_article).codename property must meet the conditions defined in rules for codenames.external_id property must not contain the following characters: /, ., ;.name and can later be modified. When only updating the name property, the item's codename is not affected by this change.idnamecodenametypeidcodenamecollectionspaces[]sitemap_locations[]external_idlast_modifiedexternal_idname and can later be modified.codename property must meet the conditions defined in rules for codenames.external_id property must not contain the following characters: /, ., ;.{
"request_id": "2d2803b7-9b67-4bd8-b3d2-436aa077827f",
"error_code": 100,
"message": "The requested content item 'f4b3fc05-e988-4dae-9ac1-a94aba566474' was not found."
}{
"id": "335d17ac-b6ba-4c6a-ae31-23c1193215cb",
"name": "My article",
"codename": "my_article",
"type": {
"id": "d89b6348-7cdc-444a-8e1e-adacb564f2a2"
},
"collection": {
"id": "00000000-0000-0000-0000-000000000000",
"codename": "default"
},
"spaces": [
{
"id": "dcbf90fb-7135-4465-8102-b3e739821ed8"
},
{
"id": "39efe8a4-23d2-4d3a-8dfb-07789668474f"
}
],
"sitemap_locations": [],
"external_id": "custom-identifier-for-my-article",
"last_modified": "2023-04-04T13:45:30.7692802Z"
}last_modified value.last_modified value.last_modified value.{
"id": "335d17ac-b6ba-4c6a-ae31-23c1193215cb",
"name": "My article",
"codename": "my_article_2",
"type": {
"id": "b7aa4a53-d9b1-48cf-b7a6-ed0b182c4b89"
},
"collection": {
"id": "00000000-0000-0000-0000-000000000000"
},
"spaces": [
{
"id": "dcbf90fb-7135-4465-8102-b3e739821ed8"
},
{
"id": "39efe8a4-23d2-4d3a-8dfb-07789668474f"
}
],
"sitemap_locations": [],
"external_id": "custom-item-identifier",
"last_modified": "2020-04-04T13:45:30.7692802Z"
}{
"id": "335d17ac-b6ba-4c6a-ae31-23c1193215cb",
"name": "My article",
"codename": "my_article",
"type": {
"id": "d89b6348-7cdc-444a-8e1e-adacb564f2a2"
},
"collection": {
"id": "00000000-0000-0000-0000-000000000000"
},
"spaces": [
{
"id": "dcbf90fb-7135-4465-8102-b3e739821ed8"
},
{
"id": "39efe8a4-23d2-4d3a-8dfb-07789668474f"
}
],
"sitemap_locations": [],
"external_id": "custom-identifier-for-my-article",
"last_modified": "2023-04-04T13:45:30.7692802Z"
}{
"items": {
"id": "335d17ac-b6ba-4c6a-ae31-23c1193215cb",
"name": "My article",
"codename": "my_article",
"type": {
"id": "d89b6348-7cdc-444a-8e1e-adacb564f2a2"
},
"collection": {
"id": "00000000-0000-0000-0000-000000000000"
},
"spaces": [
{
"id": "dcbf90fb-7135-4465-8102-b3e739821ed8"
},
{
"id": "39efe8a4-23d2-4d3a-8dfb-07789668474f"
}
],
"sitemap_locations": [],
"external_id": "custom-identifier-for-my-article",
"last_modified": "2023-04-04T13:45:30.7692802Z"
},
"pagination": {
"continuation_token": "W3sidG9rZW4iOiIrUklEOn...",
"next_page": "https://manage.kontent.ai/v2/your/chosen/list/endpoint"
}
}last_modified value.// 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
.viewContentItem()
.byItemId('f4b3fc05-e988-4dae-9ac1-a94aba566474')
// .byItemCodename('my_article')
// .byItemExternalId('59713')
.toPromise();
// 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',
});
// Gets the first page of results
const response = await client.listContentItems().toPromise();
// Gets all pages of results
// const response = await client.listContentItems()
// .toAllPromise();
// 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',
});
// Updates an existing content item
const response = await client
.updateContentItem()
.byItemId('f4b3fc05-e988-4dae-9ac1-a94aba566474')
// .byItemCodename('my_article')
// .byItemExternalId('59713')
.withData({
name: 'On Roasts',
codename: 'my_article_my_article',
})
.toPromise();
// Creates a new content item
const response = await client
.upsertContentItem()
.byItemExternalId('59713')
.withData({
name: 'On Roasts',
codename: 'my_article_my_article',
// 'type' is only required when creating a new content item
type: 'article',
})
.toPromise();
{
"id": "335d17ac-b6ba-4c6a-ae31-23c1193215cb",
"name": "My new article",
"codename": "my_article",
"type": {
"id": "b7aa4a53-d9b1-48cf-b7a6-ed0b182c4b89"
},
"collection": {
"id": "00000000-0000-0000-0000-000000000000"
},
"spaces": [
{
"id": "dcbf90fb-7135-4465-8102-b3e739821ed8"
},
{
"id": "39efe8a4-23d2-4d3a-8dfb-07789668474f"
}
],
"sitemap_locations": [],
"last_modified": "2020-04-04T13:45:30.7692802Z"
}// 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
.deleteContentItem()
.byItemId('f4b3fc05-e988-4dae-9ac1-a94aba566474')
// .byItemCodename('my_article')
// .byItemExternalId('59714')
.toPromise();
// 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
.addContentItem()
.withData({
name: 'On Roasts',
codename: 'my_article_my_article',
type: {
codename: 'article',
},
collection: {
codename: 'default',
},
external_id: '59713',
})
.toPromise();