QuestionQ2

VerifiedDesign and implement API-led integrations

A shopping API includes a method that retrieves store details by department.

To obtain information about a specific store, web clients submit requests with a query parameter named department and a URI parameter named storeId.

Which RAML snippet validly supports web-client requests to retrieve data for a particular storeId and department name?

Explanation

RAML resources are declared as root-relative paths, and a path segment wrapped in curly braces such as /{storeId} automatically defines a URI parameter for that resource; uriParameters is a resource-level facet, not a method-level facet, so nesting it directly beneath a get: method without an enclosing /{storeId}: resource is invalid RAML. Query parameters, by contrast, belong under the queryParameters node nested beneath the HTTP method that accepts them. Only the snippet that defines the resource path as /{storeId} and nests get: queryParameters: department: beneath it satisfies both requirements correctly.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!