300-635 · Question #52
Which NX-API request queries the MAC address table?
The correct answer is D. { "jsonrpc": "2.0", "method": "cli_show", "params": { "command": "show mac address-table", "version": 1 }, "id": 1 }. Option D is correct because a valid NX-API JSON-RPC request requires all three of these elements to align: the JSON-RPC version must be "2.0", the method must be "cli_show" (the method that returns structured JSON output for show commands), and the parameter key for the command s
Question
Options
- A{ "jsonrpc": "1.0", "method": "cli", "params": { "cmd": "show mac address-table", "version": 1 }, "id": 1 }
- B{ "jsonrpc": "2.0", "method": "cli", "params": { "command": "show mac address-table", "version": 1 }, "id": 1 }
- C{ "jsonrpc": "2.0", "method": "cli_show", "params": { "cmd": "show mac address-table", "version": 1 }, "id": 1 }
- D{ "jsonrpc": "2.0", "method": "cli_show", "params": { "command": "show mac address-table", "version": 1 }, "id": 1 }
How the community answered
(36 responses)- A3% (1)
- B3% (1)
- C6% (2)
- D89% (32)
Explanation
Option D is correct because a valid NX-API JSON-RPC request requires all three of these elements to align: the JSON-RPC version must be "2.0", the method must be "cli_show" (the method that returns structured JSON output for show commands), and the parameter key for the command string must be "command".
Why the distractors fail:
- A fails on two counts: it incorrectly uses JSON-RPC version
"1.0"and the wrong method"cli"instead of"cli_show". - B uses the correct version
"2.0"and correct"command"key, but the method"cli"is wrong -clireturns raw ASCII output, not structured data. - C has the right version
"2.0"and correct method"cli_show", but uses"cmd"as the parameter key instead of"command", making the request malformed.
Memory tip: Think "2-Show-Command" - JSON-RPC 2.0 + cli_show + command key. If any of those three are off, the request is broken. Watch out for "cli" vs "cli_show" and "cmd" vs "command" - those are the classic traps on this type of question.
Topics
Community Discussion
No community discussion yet for this question.