MULE-101 practice question 8 of 15

According to MuleSoft's recommended REST conventions, which HTTP method should an API use to specify how API clients can request data from a specified resource?

Full set: 55 questions
Answer options
A: GET Correct answer
B: POST
C: PUT
D: PATCH
Correct Answer:
A. GET
Explanation

According to standard RESTful conventions, which MuleSoft's recommendations are based on, the HTTP GET method is used to request a representation of a specified resource. GET requests should only retrieve data and should have no other effect on the resource's state. This makes the method safe and idempotent, meaning multiple identical GET requests will yield the same result without altering the server. This directly aligns with the requirement to "request data from a specified resource."

Why Incorrect

B. POST: This method is primarily used to create a new subordinate resource or to trigger actions that are not idempotent.
C. PUT: This method is used to replace an entire resource at a specific URI or create it if it does not exist.
D. PATCH: This method is used to apply partial modifications to an existing resource. ---

References

1. MuleSoft Documentation, "Designing APIs": The official documentation on API design outlines the standard use of HTTP methods. It implicitly supports that GET is for retrieval when describing how to define methods for resources in RAML. For example, defining a /users resource with a get: method indicates a request to retrieve a list of users.

Source: MuleSoft Documentation Portal, "Designing APIs" section, specifically within tutorials for creating API specifications using RAML or OAS.

2. Fielding, R. T., "Architectural Styles and the Design of Network-based Software Architectures" (Ph.D. dissertation): This foundational text by the creator of REST defines the semantics of HTTP methods.

Reference: Chapter 5, Section 5.1.1, "Method Definitions," specifies that GET is used for retrieval of whatever information is identified by the Request-URI.

3. IETF RFC 7231, "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content": This is the formal standard defining HTTP methods.

Reference: Section 4.3.1, "GET," states, "The GET method requests transfer of a current selected representation for the target resource."

Scroll to Top