Study FAQ
How do you choose and safely repeat HTTP methods for a network REST API?
Also asked as 2
- How do CRUD operations map to REST API methods, and which methods are safe to retry?
- What should you verify about HTTP methods, credentials, and retries before calling a network REST API?
Answer
Start with the endpoint's documented resource URL, supported HTTP method, request format, and authentication. Typically GET reads a representation, POST submits content for processing or creation, PUT creates or replaces the state at a target URI, PATCH applies a partial change, and DELETE requests removal of the target resource's association. The endpoint contract defines which actions are supported and what they do.
HTTP defines GET, PUT, and DELETE as idempotent. Repeating the same request has the same intended server effect, even if the responses differ. Idempotent describes the repeat effect. PUT and DELETE can still change the resource. POST and PATCH need an endpoint-specific retry decision. If a write times out, check whether the request took effect before resending it, especially if a repeat can create another object or run an action again.
Follow the API's documented authentication scheme and grant the client only its required access. For example, Cisco Catalyst Center API 3.1.6 documents obtaining an access token and including it in the X-Auth-Token header for subsequent requests. Protect credentials in transit and keep them out of request logs. Verify the returned state or task outcome after a change.
References
Full explanation
Network Automation, REST APIs, JSON, Ansible, Terraform, and AI
Study guide · 200-301
Read the full explanation