350-601 · Question #376
A DevOps engineer must implement a bash script to query a REST API and return the available methods. Which code snippet completes the script?
The correct answer is D. OPTIONS. To query a REST API and discover the available HTTP methods for a resource, a DevOps engineer should use the OPTIONS HTTP method.
Question
A DevOps engineer must implement a bash script to query a REST API and return the available methods. Which code snippet completes the script?
Options
- ADELETE
- BTRACE
- CPOST
- DOPTIONS
How the community answered
(17 responses)- B6% (1)
- C12% (2)
- D82% (14)
Why each option
To query a REST API and discover the available HTTP methods for a resource, a DevOps engineer should use the OPTIONS HTTP method.
DELETE is used to remove a resource from the server, not to inquire about available methods.
TRACE is used for debugging purposes, echoing the received request back to the client, and does not return available methods.
POST is used to submit an entity to the specified resource, often causing a change in state or side effects, and does not return available methods.
The OPTIONS HTTP method is specifically designed to query a server or an API endpoint about the communication options and methods supported for a given URL, typically returning an 'Allow' header with the available methods.
Concept tested: REST API HTTP methods, API discovery
Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
Topics
Community Discussion
No community discussion yet for this question.