They are correct, I just tried it against an IOS-EX device and XML was default:
SHOW VERSION OUTPUT (cut down):
CiscoCSR1000v16.12.1a-1#show ver
Cisco IOS XE Software, Version 16.12.01a
Cisco IOS Software [Gibraltar], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.12.1a, RELEASE SOFTWARE (fc2)
DEFAULT CURL OUTPUT:
curl -k https://192.168.2.48/restconf/ -u "admin:admin"
<restconf xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<data/>
<operations/>
<yang-library-version>2016-06-21</yang-library-version>
</restconf>
CURL OUTPUT WHEN ACCEPT = JSON:
curl -k https://192.168.2.48/restconf/ -u "admin:admin" -H "Accept: application/yang-data+json"
{"ietf-restconf:restconf":{"data":{},"operations":{},"yang-library-version":"2016-06-21"}}
IOS-XE
The following services are supported by the REST connector for IOS-XE.
get
API to send GET command to the device.
Argument Description Default
content_type Content type returned(xml or json) (optional) json
post
API to send POST command with optional payload to the device.
Argument Description Default
content_type Content type retorned(xml or json) (optional) json or xml
Note:
If the content_type option is not passed, the script will try to detect if the payload is XML,
otherwise it will assume JSON. The content-type and accept headers will be set based on the
detected payload or on the passed content-type.
DEVAST BOOK
There are two new media types defined for RESTCONF:
application/yang.api+xml for XML-encoded payloads
application/yang.api+json for JSON-encoded data
https://pubhub.devnetcloud.com/media/rest-connector/docs/user_guide/services/iosxe.html#
People who say XML have reason, I did the test with a router CRS1000v and got a XML. Simplely I obtained:
<restconf xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<data/>
<operations/>
<yang-library-version>2016-06-21</yang-library-version>
</restconf>
But in the texts says JSON. In conclution change my position to XML as default.
Should be Json based on below source code:https://www.netconfcentral.org/modules/netconfd-pro/2021-10-13/source/cooked/
leaf restconf-default-encoding {
type enumeration {
enum "json" {
value 0;
description
"Use JSON message encoding as the default.";
}
enum "xml" {
value 1;
description
"Use XML message encoding as the default.";
}
}
default "json";
description
"Specifies the default response encoding to use if the
incoming request does not have an indication of
preferred content type (e.g., no Content-Type header,
no Accept header).
";
Yep. It's C. I just ran a simple cURL query on an IOS-XE device without any Accept headers and it returned XML. I had to add the Accept: application/yang-data+json header to get JSON.
A
The Cisco IOS XE REST API uses the HTTP request methods described in Table 1-2.
Note All REST API requests and responses must be in JSON format. XML is not supported
https://www.cisco.com/c/en/us/td/docs/routers/csr1000/software/restapi/restapi/RESTAPIintro.pdf
When a Cisco IOS XE networking device is configured using RESTCONF (REpresentational State Transfer Configuration Protocol), the default data-encoding method is JavaScript Object Notation (JSON). JSON is a lightweight data interchange format that is easy to read and write and is commonly used in RESTful APIs.
In addition to JSON, RESTCONF also supports the Extensible Markup Language (XML) as a data-encoding method. You can specify which data-encoding method to use by including the appropriate media type in the "Content-Type" header of the RESTCONF request. For example, to use JSON encoding, you would include the media type "application/yang-data+json" in the "Content-Type" header. To use XML encoding, you would include the media type "application/yang-data+xml" in the "Content-Type" header.
RESTCONF—Uses structured data (XML or JSON) and YANG to provide a REST-like APIs.
https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/prog/configuration/166/b_166_programmability_cg/restconf_prog_int.html#:~:text=RESTCONF%E2%80%94Uses%20structured%20data%20(XML%20or%20JSON)%20and%20YANG%20to%20provide%20a%20REST%2Dlike%20APIs
The answer is JSON. It is in page 4 in the link https://www.cisco.com/c/en/us/td/docs/routers/csr1000/software/restapi/restapi/RESTAPIintro.pdf
Cisco IOS XE REST API Request Methods
The Cisco IOS XE REST API uses the HTTP request methods described in Table 1-2.
Note All REST API requests and responses must be in JSON format. XML is not supported.
The IOS-XE documentation “Cisco IOS-XE REST API Managment Reference Guide” states : “All REST API requests and responses must be in JSON format. XML is not supported.”
Link referenced does not suggest that XML is the default encoding method. In fact, the first example shows JSON returned. RESTCONF on IOS XE supports both JSON and XML as data-encoding methods
This section is not available anymore. Please use the main Exam Page.200-901 Exam Questions
Log in to ExamTopics
Sign in:
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.
ThePokemonNuzlockingMaster
Highly Voted 3 years agoaplicacion101
Most Recent 7 months, 3 weeks agoaplicacion101
2 years, 6 months agoSR_Cisco
7 months, 3 weeks agonunyabeez
2 years, 3 months agotony554556
2 years, 4 months agochris_edwards
2 years, 4 months agomellohello
2 years, 6 months agoconcepcionz
2 years, 6 months agoEngr_Aamir
2 years, 7 months agomacxsz
2 years, 8 months agoMMJa
2 years, 8 months agoart2dtwo
2 years, 9 months agoNeed_to_pass
2 years, 10 months agomacxsz
2 years, 11 months agoJedifurby
3 years, 1 month agomacxsz
2 years, 8 months agosackla
3 years, 10 months agoDaeh
3 years, 10 months agohottopic
3 years, 8 months agoTushu
3 years, 10 months ago