REST Query Collection Based on Custom Field

I imagine this should be a simple question but I cannot find an answer.

I am trying to query using the REST API for one article with my custom field id of THIS_IS_IT ;

The issue is I receive an array of every article no matter how I configure the filter object. What am I doing wrong?

const options = {
   url: `${config.cms.endpoint}collections/get/articles?token=${config.cms.apiKey}`,
   method: 'POST',
   encoding: 'utf-8',
   body: JSON.stringify({
     filter: { published: true, id: 'THIS_IS_IT' },
     sort: { _created: -1 },
   }),
   resolveWithFullResponse: false,
 };

 const articles = await request(options);

Thank you so much!

I guess If you’re using JSON.stringify, you should add "Content-type: application/json" . Otherwise, it will use a default "application/x-www-form-urlencoded"

As I understand, you’re filtering by ID and it will return a specific entry. So, sort isn’t necessary here.

You can also try this below option


${config.cms.endpoint}collections/get/articles?filter[published]=true&filter[id]=THIS_IS_IT&token=${config.cms.apiKey}