Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Record

Validates an existing record field

Body parameters

id string Required

RFC 4122 UUID of record expressed in URL-safe base64 format

Example: "hWl-mnkWRYmMCSTq4z_piQ"
type string Required

Must be exactly "item".

relationships.item_type.data Required

The record's model

relationships.creator.data Optional

The entity (account/collaborator/access token/sso user) who created the record

Examples

POST https://site-api.datocms.com/items/:item_id/validate HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"id": "hWl-mnkWRYmMCSTq4z_piQ",
"type": "item",
"attributes": {
"title": "My first blog post!",
"content": "Lorem ipsum dolor sit amet...",
"category": "24",
"image": {
"upload_id": "1235",
"alt": "Alt text",
"title": "Image title",
"custom_data": {}
}
},
"relationships": {
"item_type": {
"data": {
"type": "item_type",
"id": "DxMaW10UQiCmZcuuA-IkkA"
}
}
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/items/:item_id/validate' \
-X POST \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"id":"hWl-mnkWRYmMCSTq4z_piQ","type":"item","attributes":{"title":"My first blog post!","content":"Lorem ipsum dolor sit amet...","category":"24","image":{"upload_id":"1235","alt":"Alt text","title":"Image title","custom_data":{}}},"relationships":{"item_type":{"data":{"type":"item_type","id":"DxMaW10UQiCmZcuuA-IkkA"}}}}}'
await fetch("https://site-api.datocms.com/items/:item_id/validate", {
method: "POST",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: {
id: "hWl-mnkWRYmMCSTq4z_piQ",
type: "item",
attributes: {
title: "My first blog post!",
content: "Lorem ipsum dolor sit amet...",
category: "24",
image: {
upload_id: "1235",
alt: "Alt text",
title: "Image title",
custom_data: {},
},
},
relationships: {
item_type: {
data: { type: "item_type", id: "DxMaW10UQiCmZcuuA-IkkA" },
},
},
},
}),
});