200-901 Infrastructure and Automation Practice Question
In a Python script using the 'requests' library to interact with Cisco DNA Center API, which function call is used to send a POST request with JSON data?
⚠ Common exam trap
Cisco often tests the distinction between POST and PUT by having candidates confuse resource creation (POST) with resource replacement (PUT), especially when both methods accept a JSON body.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
requests.post(url, json=data)
The `requests.post()` function is specifically designed to send HTTP POST requests, and passing the `json=data` parameter automatically serializes the Python dictionary to JSON and sets the `Content-Type` header to `application/json`. This is the standard way to create a resource via Cisco DNA Center's REST API endpoints that expect JSON payloads.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
requests.post(url, json=data)
Why this is correct
The requests library's post function accepts a json keyword argument that serialises the Python dictionary and sets the Content-Type header to application/json automatically. Calling requests.post(url, json=data) therefore sends the POST request with JSON payload to the Cisco DNA Center API.
- ✗
requests.patch(url, json=data)
Why it's wrong here
requests.patch sends an HTTP PATCH request for partial resource modification, so it cannot issue the POST the DNA Center API expects. It is tempting because PATCH also carries a json= payload, but the method verb differs; POST is required for creating resources.
- ✗
requests.get(url, json=data)
Why it's wrong here
requests.get performs an HTTP GET, which retrieves a resource and carries no request body, so passing json= is meaningless for creating data. It is tempting because the call syntax looks identical, but GET cannot submit the JSON payload a POST requires.
- ✗
requests.put(url, json=data)
Why it's wrong here
requests.put issues an HTTP PUT request, which replaces a resource at a known URI rather than creating one via POST. It is tempting because PUT also accepts a json= body, but the DNA Center API's create operations require the POST verb, not PUT.
Go deeper
Related to this question
About these practice questions
This 200-901 question is part of Courseiva's 975-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.