Bird
0
0

Which of the following is the correct syntax to add two search parameters type=book and author=John in a REST API URL?

easy📝 Syntax Q3 of 15
Rest API - Query Parameters and Filtering

Which of the following is the correct syntax to add two search parameters type=book and author=John in a REST API URL?

A/api/items&type=book?author=John
B/api/items?type=book&author=John
C/api/items?type=book?author=John
D/api/items/author=John&type=book
Step-by-Step Solution
Solution:
  1. Step 1: Understand the order of parameters in URL

    The first parameter starts with ?, and subsequent parameters are joined with &.
  2. Step 2: Check each option's syntax

    /api/items?type=book&author=John correctly uses ? then &. Others misuse symbols or order.
  3. Final Answer:

    /api/items?type=book&author=John -> Option B
  4. Quick Check:

    First param ? then & for others [OK]
Quick Trick: First param uses ?, others use & [OK]
Common Mistakes:
MISTAKES
  • Using multiple ? symbols
  • Using & before the first parameter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes