Free Google Apigee-API-Engineer Actual Exam Questions - Question 15 Discussion
design Which design should you use?
It’s B because query parameters are meant for filtering and don’t change the resource itself. A feels more like an RPC call, not RESTful. Also, POST in D is unnecessary since this is just a GET operation.
It’s B for me too. Using query parameters to specify date ranges fits REST principles since you’re just filtering the orders resource, not creating or updating anything. A puts filters awkwardly in the path, which is more like RPC and less flexible if you want to add other filters later. C adds unnecessary customer context which the question doesn’t ask for. D uses POST, which isn’t right here because GET is meant for retrieving data, and you don’t need a request body just to filter. So B’s clean, straightforward, and makes sense.
I’m going with B here too, but mainly because GET with query parameters is the most RESTful way to filter resources. A’s path segments don’t really suit filtering—it’s better for resource hierarchy. D’s POST is off since POST is for creating or complex queries, not simple filters. C could be right if we were narrowing by customer, but since it’s just orders in a date range, B fits best.
Query params are cleaner than path segments for filters, so B.
Option B seems right since filtering with query parameters is the usual REST way. A puts filters in the path, which is less flexible and more of an RPC style.
Probably B makes the most sense since query params are standard for filtering in REST. It’s cleaner than A’s path approach and avoids POST’s extra complexity when GET suffices.
B Using query parameters keeps the URL clean and flexible for filtering. It’s better than putting dates in the path or using POST when a simple GET filter suffices.
I’m thinking about RESTful best practices, and option A looks off because embedding dates directly in the path feels like it’s creating a custom operation rather than filtering a resource. Query parameters (like in B and C) are usually the way to go for filtering. Between B and C, if the question doesn’t mention filtering by customer, C might be unnecessarily specific. Also, D using POST just to search seems too heavyweight for a simple date filter. So, would it make sense to rule out A and D mainly because they don’t keep the request stateless or idempotent like a typical GET with query param
B/C? B is good for general filtering by date, but if the question implied a specific customer, C would be better since it scopes orders by customer. Without that detail, B feels like the safest choice.
B fits REST principles by using query parameters to filter resources with GET.
Option A seems off since REST best practices avoid putting filters directly in the path like that. B uses query params with GET, which is more standard. What do you think about C though, since it adds a customer scope?
It’s B for sure. Using query parameters with a GET request is the cleanest RESTful approach for filtering resources like orders by date. Option A looks like it’s trying to encode filter criteria in the path, which isn’t ideal—it makes the URL less flexible and harder to extend with other filters later. C adds customer-specific filtering which wasn’t asked, so it’s extra. D uses POST which isn’t right since we’re just retrieving data, not creating or updating anything. So B is both simple and standard for this case.
B makes the most sense here since GET with query params is standard for filtering in REST APIs.