Content Management API - Filter by field

Hi! Just wondering - is there a way to filter by field in the management api (like using the Field Filters in the Content api)? I’d settle for a simple equality check :slight_smile:

The reason being - I need a ‘singleton’ type of model…
i.e.

  • for a Model called ‘About Us’ (contains 3 fields, one of which being ‘customer_id’)
  • I need to find the About Us Record for a given customer_id (should only be one or none)

At the moment - I having the following choices:

  • maintain an index locally in the db (yuk - possible referential integrity issues),
  • pull every About Us Record and filter locally (big overhead for me and you guys servicing ‘x’ pages of results)
  • Implement a GraphQL client server side and juggle between the js client and graphql client depending on the operation…

The last atm is my preferred course of action, but its a pain… unless I am missing something in the docs?

If there is no way to do this via the management api, like there is with the content api - are there any plans to implement this in the not too distant future?

Thanks heaps - and love your work :slight_smile:

hello @devaccounts

I’m not sure if we are talking about the same thing, but if you are talking about filtering records using the REST API, have you tried something like this:

filter["fields"]["title"]["eq"]: "title"

Is this what you were looking for?

If so please try inspecting what we are doing in the CMS UI so that you can replicate what we do in your calls. We are going to expand the docs very soon!

Thanks! That’s the missing piece - I can now filter on fields using the management api (js client) :slight_smile:

1 Like