Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Uploads filter

Create a new filter

Body parameters

id string Optional

RFC 4122 UUID of upload filter expressed in URL-safe base64 format

Example: "-Lo34LFSTLmgPToamzJLcg"
type string Required

Must be exactly "upload_filter".

attributes.name string Required

The name of the filter

Example: "Draft posts"
attributes.filter object Required

The actual filter

Example: { status: { eq: "draft" } }
attributes.shared boolean Required

Whether it's a shared filter or not

Returns

Returns a resource object of type upload_filter.

Examples

POST https://site-api.datocms.com/upload-filters HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "upload_filter",
"attributes": {
"name": "Draft posts",
"filter": {
"status": {
"eq": "draft"
}
},
"shared": true
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/upload-filters' \
-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":{"type":"upload_filter","attributes":{"name":"Draft posts","filter":{"status":{"eq":"draft"}},"shared":true}}}'
await fetch("https://site-api.datocms.com/upload-filters", {
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: {
type: "upload_filter",
attributes: {
name: "Draft posts",
filter: { status: { eq: "draft" } },
shared: true,
},
},
}),
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "upload_filter",
"id": "-Lo34LFSTLmgPToamzJLcg",
"attributes": {
"name": "Draft posts",
"filter": {
"status": {
"eq": "draft"
}
},
"shared": true
}
}
}