DevNet Associate (DEVASC) v1.0Understanding and Using APIsEasy
A developer is designing an application that will interact with a Cisco API to provision network devices. The API uses REST principles. Which of the following HTTP methods is typically used to create a new resource on the server?
- APOST
- BDELETE
- CPUT
- DGET
Show answer & explanationAnswer & explanation
Correct answer: A. POST
The POST method is conventionally used in RESTful APIs to create new resources on the server. This aligns with the developer's requirement to provision new network devices.
Why the other options are wrong
- B. DELETE is used to remove a specified resource from the server.
- C. PUT is typically used to update an existing resource or create a resource if it does not exist at a known URI.
- D. GET is used to retrieve resource representations, not create them.
HTTP POST Method
The HTTP POST method sends data to the server to create a new resource. It is often used when submitting forms or uploading files.
- Creates a new resource.
- Data is sent in the request body.
- Results in a change on the server.
Memory trick: CRUD operations map directly to HTTP verbs.