exam questions

Exam 200-901 All Questions

View all questions & answers for the 200-901 exam

Exam 200-901 topic 1 question 14 discussion

Actual exam question from Cisco's 200-901
Question #: 14
Topic #: 1
[All 200-901 Questions]

FILL BLANK -
Fill in the blanks to complete the Python script to request a service ticket using the APIC-EM REST API for the user `devnetuser`. import requests import json controller = 'devnetapi.cisco.com/sandbox/apic_em' url = `https://` + controller + `api/va/ticket` payload = {'username': '_________________', 'password': '370940885'} header = {'Content-type': 'application.json'} response = _______________________.post(url, data=json.dumps(payload), \ headers= ______________________, verify=False) r_json = response.json() print(r_json) ticket = r_json[`response`][`serviceTicket`] print(ticket)

Show Suggested Answer Hide Answer
Suggested Answer: See explanation below.
devnetuser
requests
header
Reference:
https://developer.cisco.com/docs/apic-em/#!hello-world

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Lagann92
Highly Voted 2 years, 7 months ago
The format on this questions is horrible…
upvoted 12 times
...
herrmann69
Most Recent 9 months, 1 week ago
Readable format with blanks: import requests import json controller = 'devnetapi.cisco.com/sandbox/apic_em' url = https:// + controller + api/va/ticket payload = {'username': '_________', 'password': '370940885'} header = {'Content-type': 'application/json'} response = _________.post(url, data=json.dumps(payload), headers=_________, verify=False) r_json = response.json() print(r_json) ticket = r_json[response][serviceTicket] print(ticket)
upvoted 4 times
...
Pelau_the_Engineer
1 year, 9 months ago
import requests import json controller = 'devnetapi.cisco.com/sandbox/apic_em' url = https:// + controller + api/va/ticket payload = {'username': 'devnetuser', 'password': '370940885'} header = {'Content-type': 'application/json'} response = requests.post(url, data=json.dumps(payload), headers=header, verify=False) r_json = response.json() print(r_json) ticket = r_json[response][serviceTicket] print(ticket) This script uses the requests library to make a POST request to the APIC-EM REST API to request a service ticket for the user devnetuser. The payload of the request includes the user's username and password, and the headers include the content-type as 'application/json'. The script also includes a verify=False to avoid any SSL certificate verification. The response is in json format and the script parse it to get the service ticket. The ticket is then printed.
upvoted 4 times
...
moha413
1 year, 10 months ago
import requests import json controller = ‘devnetapi.cisco.com/sandbox/apic_em’ url = “https://” + controller + “api/va/ticket” payload = {‘username’: ‘ ’, ‘password’: ‘370940885’} header = {‘Content-type’: ‘application.json’} response = .post(url, data=json.dumps(payload), \ headers= , verify=False) r_json = response.json() print(r_json) ticket = r_json[“response”][“serviceTicket”] print(ticket) Correct Answer: See explanation below Section: (none) devnetuser requests header https://developer.cisco.com/docs/apic-em/#!hello-world/issuing-requests-in-the-postman-gui
upvoted 1 times
...
bitstomp
2 years, 8 months ago
devnetuser, requests, header
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago