A network automation engineer attempts to create a new syslog host entry on a Cisco router using RESTCONF. The engineer sends an HTTP POST request to the parent container endpoint `/restconf/data/Cisco-IOS-XE-native:native/logging/host`. The API gateway responds with an HTTP status code of `409 Conflict` because a syslog host entry with the specified IP address already exists. Which HTTP request method and URI target combination must the engineer use to completely replace the existing syslog host entry configuration?
- Issue an HTTP PUT request targeting the specific resource URI `/restconf/data/Cisco-IOS-XE-native:native/logging/host/name=192.168.1.50` with the complete resource payload.Answer
- BIssue an HTTP POST request targeting the specific resource URI `/restconf/data/Cisco-IOS-XE-native:native/logging/host/name=192.168.1.50` with only the modified parameters.
- CIssue an HTTP GET request containing a request body with the updated configuration fields to the container URI `/restconf/data/Cisco-IOS-XE-native:native/logging/host`.
- DIssue an HTTP OPTIONS request to the root datastore URI `/restconf/data` to automatically clear and re-create the logging configuration.
Answer
Issue an HTTP PUT request targeting the specific resource URI `/restconf/data/Cisco-IOS-XE-native:native/logging/host/name=192.168.1.50` with the complete resource payload.
In REST-based APIs such as RESTCONF, HTTP POST maps to Create operations under a collection URI. When a resource already exists, POST yields a 409 Conflict error. To update or completely replace an existing targeted resource, the API client must send an HTTP PUT request directly to the URI identifying that specific resource instance.
Step-by-Step Solution
Key Concept
REST API CRUD Mapping (HTTP PUT vs POST)
Estimated Time:2m 0s