2

This is definitely a noob question, but I can't seem to find an answer to this. (Completely new to GraphQL).

I'm trying to simply return entries:

query test {
  entries(section: "vacancies", limit: 20) {
    title
    expiryDate
    description
  }
}

Since the description is a custom field, this gives an error. How do I get a custom field value?

1

For anything else than base element fields, you'll need to use an inline fragment to fetch your custom fields like so:

query test {
  entries(section: "vacancies", limit: 20) {
    title
    expiryDate
    ...on sectionHandle_entryTypeHandle_Entry {
      description
    }
  }
}

Replace sectionHandle and entryTypeHandle with your values, I guess something like vacancies_vacancies_Entry

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.