300-435 exam dumps

300-435 practice question 88 of 322

Automating Cisco Enterprise Solutions. Professional level, Cisco. Free question with the correct answer and a full explanation.

300-435 Question 88

Single answer

You are tasked with configuring a Cisco device using the RESTCONF API and the Python requests library. You need to update the device hostname to 'New-Host' using the RESTCONF endpoint /restconf/data/Cisco-IOS-XE-native:native/hostname. Which HTTP method and headers should you use to successfully update the device configuration?

  1. A

    Use the HTTP GET method with the headers 'Accept: application/yang-data+json' and 'Content-Type: application/yang-data+json'

  2. B

    Use the HTTP POST method with the headers 'Accept: application/yang-data+json' and 'Content-Type: application/yang-data+json'

  3. C

    Use the HTTP PUT method with the headers 'Accept: application/yang-data+json' and 'Content-Type: application/yang-data+json'

  4. D

    Use the HTTP DELETE method with no headers

Show answer and explanation

Correct answer: C

Explanation

To update the hostname of a Cisco device using the RESTCONF API and Python requests library, the HTTP PUT method is the appropriate choice. This method is used to replace or update the configuration of a specific resource. Additionally, the 'Accept' and 'Content-Type' headers must be set to 'application/yang-data+json' to specify the use of JSON formatted data compliant with YANG models.

  • A. Incorrect.

    The HTTP GET method is used to retrieve data from the RESTCONF API, not to update or modify configurations.

  • B. Incorrect.

    The HTTP POST method is used to create new configuration data but is not typically used for updating an existing configuration like the hostname.

  • C. Correct.

    The HTTP PUT method is the correct method to update or replace a configuration resource in RESTCONF. The headers 'Accept: application/yang-data+json' and 'Content-Type: application/yang-data+json' ensure the data format is properly handled.

  • D. Incorrect.

    The HTTP DELETE method is used to remove configuration data, not to update or modify it.

Timed practice exam

Take a 300-435 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam