APIGEE-API-ENGINEER practice question 15 of 25
You are adding a filter on an API to locate all orders in a specific date range You want to use a RESTful design Which design should you use?
Full set: 126 questionsThis design correctly follows RESTful principles for filtering a collection of resources. It uses the GET HTTP method for a safe and idempotent retrieval operation. The URI path /orders clearly identifies the resource collection (all orders). Critically, it uses query parameters (?from-date=...&to-date=...) to apply the filter, which is the standard and most flexible method for filtering, sorting, or paginating a resource collection without altering the resource endpoint itself.
A. This design incorrectly includes a verb (getOrdersBetweenDates) in the URI path. In REST, the URI should identify a resource (a noun), while the HTTP method (GET) specifies the action.
C. This URI is for retrieving orders belonging to a specific customer (/customers/{customer-id}/...). The question asks to locate "all orders," making /orders the more appropriate and general resource path.
D. This option incorrectly uses the POST method. Searching or filtering data is a safe and idempotent operation that should always use the GET method. POST is typically used for creating new resources.
1. Google Cloud
API Design Guide. This guide
highly relevant to Apigee
specifies standard methods for API design.
Resource Names: "Collections are identified by a plural noun... GET /v1/users". This supports using /orders for the collection of all orders. (See section: Resource Names).
Filtering: "For filtering collections
this guide recommends using a filter query parameter... GET /v1/users?filter=email:@gmail.com". This supports the use of query parameters for filtering
as seen in option B. (See section: Standard Methods > List > Filtering).
2. Fielding
R. T. (2000). Architectural Styles and the Design of Network-based Software Architectures. Doctoral dissertation
University of California
Irvine.
Chapter 5
Section 5.2.1 (Client-Server): Fielding's dissertation
the foundational text for REST
describes how the uniform interface simplifies and decouples the architecture. Using GET with query parameters for filtering is a direct application of this principle
as it uses the standard interface to query a resource representation without needing a custom method or action in the URI.
3. MIT OpenCourseWare
6.170 Software Studio
Fall 2005. Lecture 21: Web Services and REST.
Slide: "RESTful URLs": The lecture material explicitly states to use "Nouns
not verbs" for URIs (e.g.
Good: /users/123
Bad: /getUser?id=123). This directly invalidates option A. It also states to "Use query strings for filtering/sorting" (e.g.
GET /users?sort=name)
which directly supports the pattern used in option B.
Keep practicing
Take the free APIGEE-API-ENGINEER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other APIGEE-API-ENGINEER practice questions
- Question 1In your last release, there were unexpected errors uncovered by users within the first 24…
- Question 2Your company runs their internal services across two datacenters in a hot-warm configurat…
- Question 3Which features are supported in the OAulhV2 policy'? Select all that are correct. Choose …
- Question 4Which is a benefit of three-legged OAuth (authonzation_code grant)'?
- Question 5Which Apigee product feature can be used to host and version your API documentation'?
- Question 6As an API Engineer your team would like to make sure you are simulating a user experience…
