Patch Collection Item
Update only specific fields on an existing item in a collection. Unlike the Update endpoint, fields not included in the request body are left unchanged.
Request
PATCH https://app.ycode.com/api/v1/collections/{collection_id}/items/{item_id}Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_id | string | Yes | Unique identifier for the collection |
item_id | string | Yes | Unique identifier for the collection item |
Headers
| Header | Value |
|---|---|
| Authorization | Bearer YOUR_API_TOKEN |
| Content-Type | application/json |
Request body
Send a JSON object containing only the fields you want to change.
| Field | Type | Description |
|---|---|---|
_draft | boolean | Optional. When true, only the draft item is updated. If omitted and your project is published, the published record is updated by default. Whenever a published record is updated, the draft record is also updated. |
Example request body
{
"Name": "Updated blogpost title",
"Featured": 0
}Response
Returns the full item with all fields, reflecting the applied changes.
Example response
{
"_ycode_id": "16687868024636377aa7270ea9",
"ID": 2,
"Name": "Updated blogpost title",
"Created date": "2022-11-18T15:53:22.000Z",
"Updated date": "2022-11-18T15:53:22.000Z",
"Created by": "1669309481596637fa4299184e",
"Updated by": "1669309527456637fa4576f6dc",
"Summary": "Original summary unchanged",
"Body": "<p>Original body unchanged...</p>",
"Main Image": "https://storage.googleapis.com/ycode-prod-uploads/...",
"Thumbnail Image": "https://storage.googleapis.com/ycode-prod-uploads/...",
"Featured": 0,
"Author": null,
"Categories": [
"1669309639520637fa4c77eea7",
"1669309662211637fa4de338d6"
],
"Slug": "updated-blogpost-title"
}Example request
curl -X PATCH https://app.ycode.com/api/v1/collections/637781341a6f7/items/16687772264556377850a6f241 \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"Name": "Updated blogpost title",
"Featured": 0
}'To patch only the draft record:
curl -X PATCH https://app.ycode.com/api/v1/collections/637781341a6f7/items/16687772264556377850a6f241 \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"_draft": true,
"Name": "Draft-only title update"
}'Last updated on