ParthianShotgun
ParthianShotgun

Reputation: 602

How do I filter fields with Directus

Let's say I make an api call like this

    const { data } = await client.getItems(`module/${module.id}`, {
      fields: [
        'questions.module_question_id.question_text',
        'questions.module_question_id.slug',
        'questions.module_question_id.type',
        'questions.module_question_id.answer_options.*',
      ],
    });

I am grabbing the fields, but I also want to filter out a certain question ala its slug, is there a way to do this at the api level? I know filters exist as a global query api, but have not found examples of them being used in conjunction with fields.

Upvotes: 1

Views: 3243

Answers (1)

RANGER
RANGER

Reputation: 1691

Perhaps you are looking for deep? This should allow you to filter on a deeply nested relational field.

https://docs.directus.io/reference/api/query/#deep

Upvotes: 1

Related Questions