300-635 · Question #51
Using the NX-API CLI JSON-RPC interface, which two Python data structure and requests call create an SVI? (Choose two.)
The correct answer is A. requests.post (url, data=json.dumps (payload), headers={'content-type': 'application/json-rpc'}, auth=(username, password)). NX-API CLI JSON-RPC: Creating an SVI The correct answers are A and C (the question requires two; "A" alone appears to be a display artifact). Why A is correct: The JSON-RPC interface requires the Content-Type header to be application/json-rpc - not plain application/json. This…
Question
Options
- Arequests.post (url, data=json.dumps (payload), headers={'content-type': 'application/json-rpc'}, auth=(username, password))
- Brequests.post (url, data=json.dumps (payload), headers={'content-type': 'application/json'}, auth=(username, password))
- Cpayload = { "jsonrpc": "2.0", "method": "cli_conf", "params": { "command": "conf t; interface vlan " + id, "version": 1}, "id": 1}
- Dpayload = { "jsonrpc": "2.0", "method": "cli", "params": { "cmd": "conf t", "version": 1}, "id": 1 }, { "jsonrpc": "2.0", "method": "cli", "params": { "cmd": "interface vlan " + id, "version": 1}, "id": 2 }
How the community answered
(31 responses)- A81% (25)
- B10% (3)
- C3% (1)
- D6% (2)
Explanation
NX-API CLI JSON-RPC: Creating an SVI
The correct answers are A and C (the question requires two; "A" alone appears to be a display artifact).
Why A is correct: The JSON-RPC interface requires the Content-Type header to be application/json-rpc - not plain application/json. This tells the Nexus switch to route the request through the JSON-RPC endpoint rather than the REST API endpoint.
Why C is correct: For configuration commands over JSON-RPC, the correct method is cli_conf, and the parameter key is command. Option C correctly uses cli_conf with a semicolon-separated command string to enter config mode and create the VLAN interface in a single payload.
Why B is wrong: Using content-type: application/json is for the NX-API REST interface, not JSON-RPC - the switch will reject or misroute the request.
Why D is wrong: The cli method is for show/exec (read-only) commands, not configuration; its parameter key is cmd. Option D incorrectly uses cli with cmd for config operations - the right combination for configuration is cli_conf with command.
Memory tip: Think RPC → -rpc in the header, and conf → cli_conf in the method. If you're configuring, both the header suffix and the method name must say it explicitly.
Topics
Community Discussion
No community discussion yet for this question.