Content Management API > Uploads filter
Create a new filter
Body parameters
idstringOptional
RFC 4122 UUID of upload filter expressed in URL-safe base64 format
Example:
"-Lo34LFSTLmgPToamzJLcg"
namestringRequired
The name of the filter
Example:
"Draft posts"
filterobjectRequired
The actual filter
Example:
{ status: { eq: "draft" } }
sharedbooleanRequired
Whether it's a shared filter or not
Returns
Returns a resource object of type upload_filter
Examples
import { buildClient } from "@datocms/cma-client-node";
async function run() { const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const uploadFilter = await client.uploadFilters.create({ name: "Draft posts", filter: { status: { eq: "draft" } }, shared: true, });
// Check the 'Returned output' tab for the result ☝️ console.log(uploadFilter);}
run();{ id: "-Lo34LFSTLmgPToamzJLcg", name: "Draft posts", filter: { status: { eq: "draft" } }, shared: true,}