nerdexam
Cisco

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.

Automation

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)
  • B
    6% (1)
  • C
    12% (2)
  • D
    82% (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.

ADELETE

DELETE is used to remove a resource from the server, not to inquire about available methods.

BTRACE

TRACE is used for debugging purposes, echoing the received request back to the client, and does not return available methods.

CPOST

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.

DOPTIONSCorrect

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

#REST API#Bash Scripting#HTTP Methods#API Integration

Community Discussion

No community discussion yet for this question.

Full 350-601 Practice