0

I have an API I am pinging which queries a cosmos db to return records.

I can filter on a simple string in my api call like so:

// return objects where '_Subject' field equals "filterTest"
string getUrl = $"...baseApiPath/?$filter=_Subject+eq+'filterTest'";

This is working perfectly.

But I cannot figure out the filter syntax to make my API query be based on ARRAY_CONTAINS.

// return objects where '_Attachments' field CONTAINS "945afd138aasdf545a2d1";

How would I do that? Is there a general reference for API filter syntax somewhere?

kdeez
  • 681
  • 1
  • 8
  • 17

1 Answers1

0

If you're asking about how to query, a query against a property with an array of values looks like this:

SELECT * FROM c WHERE ARRAY_CONTAINS(c._Attachments, "945afd138aasdf545a2d1")

Another example in this answer.

Noah Stahl
  • 6,905
  • 5
  • 25
  • 36