Bird
0
0

You want to request only the id and title fields for articles and only the name field for authors in a single API call. Which query string is correct?

hard📝 Application Q8 of 15
Rest API - Advanced Patterns
You want to request only the id and title fields for articles and only the name field for authors in a single API call. Which query string is correct?
A/articles?fields[articles]=id,title;fields[authors]=name
B/articles?fields=articles(id,title),authors(name)
C/articles?select=articles.id,title&select=authors.name
D/articles?fields[articles]=id,title&fields[authors]=name
Step-by-Step Solution
Solution:
  1. Step 1: Understand multiple resource sparse fieldsets

    You can specify fields for multiple resources by repeating fields[resource] parameters.
  2. Step 2: Identify correct syntax

    /articles?fields[articles]=id,title&fields[authors]=name correctly uses & to separate parameters and brackets for resource names.
  3. Final Answer:

    /articles?fields[articles]=id,title&fields[authors]=name -> Option D
  4. Quick Check:

    Multiple fields[] params for different resources = /articles?fields[articles]=id,title&fields[authors]=name [OK]
Quick Trick: Use multiple fields[resource] params joined by & for multiple resources [OK]
Common Mistakes:
MISTAKES
  • Using parentheses syntax
  • Using semicolons instead of &
  • Using select instead of fields[]

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes