exam questions

Exam 350-401 All Questions

View all questions & answers for the 350-401 exam

Exam 350-401 topic 1 question 319 discussion

Actual exam question from Cisco's 350-401
Question #: 319
Topic #: 1
[All 350-401 Questions]


Refer to the exhibit. An engineer is using XML in an application to send information to a RESTCONF-enabled device. After sending the request, the engineer gets this response message and an HTTP response code of 400. What do these responses tell the engineer?

  • A. The Accept header sent was application/xml.
  • B. POST was used instead of PUT to update.
  • C. The Content-Type header sent was application/xml.
  • D. A JSON body was used.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
juliok33p
Highly Voted 4 years, 1 month ago
A is Correct Accept and Content-type are both headers sent from a client (a browser) to a service. Accept header is a way for a client to specify the media type of the response content it is expecting and Content-type is a way to specify the media type of request being sent from the client to the server. The response was sent in XML so we can say the Accept header sent was application/xml.
upvoted 21 times
...
networkispower
Highly Voted 2 years, 4 months ago
Selected Answer: A
Correct answer is A. Tested using Postman. When using application/xml on the Accept Header (HTTP 400 Bad Request): { "errors": { "error": [ { "error-message": "mismatched keypaths: /interface , /if:interfaces", "error-path": "/ietf-interfaces:interfaces", "error-tag": "malformed-message", "error-type": "application" } ] } } When using application/xml on the Content-Type Header (HTTP 415 Unsupported Media Type): { "errors": { "error": [ { "error-message": "Unsupported media type: application/xml ; Should be one of: application/yang-data+xml, application/yang-data+json.", "error-tag": "malformed-message", "error-type": "application" } ] } }
upvoted 14 times
...
lluisyast
Most Recent 1 month, 3 weeks ago
Selected Answer: D
I tested it on devnetsandboxiosxe.cisco.com and I get that error if I try to create an interface using JSON as the payload, but specifying application/yang-data+xml in Content-Type curl --user "admin:C1sco12345" -k -H "Accept: application/yang-data+xml" -H "Content-Type:application/yang-data+xml" -X POST -d @data.json http s://devnetsandboxiosxe.cisco.com/restconf/data/Cisco-IOS-XE-native:native/interface <errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"> <error> <error-type>application</error-type> <error-tag>malformed-message</error-tag> <error-path xmlns:ios="http://cisco.com/ns/yang/Cisco-IOS-XE-native">/ios:native/ios:interface</error-path> <error-message>End-of-file reached in XML stream</error-message> </error> </errors>
upvoted 1 times
...
[Removed]
10 months, 3 weeks ago
Selected Answer: C
C is correct The error message indicates "End-of-file reached in XML stream": means that the XML data sent was incomplete or improperly closed. The error tag "malformed-message": means that the problem lies with the structure or content of the XML sent. I think A is incorrect, because if there was an issue with the Accept header, the error would likely indicate a problem with the response format, not the request body. The error message here specifically indicates an issue with the XML stream being sent, not with receiving data. - Content-Type Header: Specifies the format of the data being sent in the body of the request (e.g., application/xml for XML data).´ - Accept Header: Specifies the format of the response the client can handle (e.g., application/xml for XML responses).
upvoted 1 times
...
cy111
11 months ago
Given that the issue is related to an improperly formatted XML body in the request and considering the options provided, the correct answer would be related to the Content-Type header. A. The Accept header sent was application/xml: This option is incorrect because the Accept header specifies what media types the client is willing to receive, not what was sent. B. POST was used instead of PUT to update: This is incorrect because the HTTP method used is not indicated as the problem here. C. The Content-Type header sent was application/xml: This is the most appropriate answer. The error message and the HTTP 400 response code indicate that the request was expected to be in XML format (as indicated by the Content-Type header), but the XML was malformed. D. A JSON body was used: This is incorrect because the error message specifically refers to an XML stream, not JSON.
upvoted 1 times
...
mahnazmohamz
1 year, 7 months ago
help im so confused
upvoted 1 times
...
HungarianDish_111
2 years, 1 month ago
Could someone research this topic please? "using XML in an application to send information" => Does this mean using "Content-Type: application/xml"? If yes, then JSON body would cause HTTP 400 error. Thus, I would go for D) "A JSON body was used." https://csod.my.site.com/supportcentral/s/article/How-do-I-resolve-HTTP-400-Bad-Request-errors-returned-by-Cornerstone-s-APIs?language=en_US "Verify that the Content-Type request header matches the raw body data type. Example: If your raw request body data is in JSON, but the Content-Type request header value contains "application/xml", you will encounter an HTTP 400 error." Plus: https://reqbin.com/req/3mrxjgw4/post-xml-example https://reqbin.com/req/abghm4zf/json-content-type
upvoted 1 times
...
dnjJ56
2 years, 4 months ago
Selected Answer: C
The errors says " End of Life for XML stream' and it also says ' malformed message'. That means, the format of the data inside the request, which seems to be XML based on the error, is not compatible with what server expects. We define the format of the data inside the request using the Content-Type header (not by the Accept header). So I go with C.
upvoted 2 times
...
Zizu007
2 years, 5 months ago
Selected Answer: D
D - Correct; when using Accept and Content-Type : application/yang-data+xml and Body content is JSON: <errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"> <error> <error-message>End-of-file reached in XML stream</error-message> <error-path>/ietf-interfaces:interfaces</error-path> <error-tag>malformed-message</error-tag> <error-type>application</error-type> </error> </errors> when using Accept and Content-Type : application/yang-data+xml and Body content is XML: Status: 201
upvoted 3 times
Zizu007
2 years, 5 months ago
A - Wong; don't get confused between application/xml and application/yang-data+xml. when using Accept: 'application/xml' you will get this error: <errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"> <error> <error-message>No acceptable mime-type supported. Got: application/xml ; Should be one of: application/yang-data+xml, application/yang-data+json, application/vnd.yang.collection+xml, application/vnd.yang.collection+json, application/yang-patch+xml, application/yang-patch+json.</error-message> <error-tag>invalid-value</error-tag> <error-type>application</error-type> </error> </errors> -----------------------------------------------------------------
upvoted 1 times
Zizu007
2 years, 5 months ago
when using Accept and Content-Type : application/yang-data+xml and Body content is XML: Status: 201
upvoted 1 times
...
...
Zizu007
2 years, 5 months ago
C - Wrong, same as A. when using Content-Type: 'application/xml' you will get this error: <errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"> <error> <error-message>Unsupported media type: application/xml ; Should be one of: application/yang-data+xml, application/yang-data+json.</error-message> <error-tag>malformed-message</error-tag> <error-type>application</error-type> </error> </errors> -----------------------------------------------------------------
upvoted 1 times
...
...
Darude
2 years, 5 months ago
Selected Answer: C
Correct answer is C problem here is that the path of the interface isn't correct but there is no answer for that. Look at the atached link. there are two examples search for "3.6.3. Encoding Operation Resource Errors" there are two examples of error message one in Content-type in xml and other Content-type in json the result match the error message Content-type in xml LINK: https://datatracker.ietf.org/doc/html/draft-ietf-netconf-restconf-14#section-3.6.3
upvoted 3 times
...
Wooker
2 years, 7 months ago
Selected Answer: A
the correct answer is A.
upvoted 1 times
...
[Removed]
2 years, 9 months ago
Selected Answer: C
Check the first line. It's saying xml but requstion yang-restconf
upvoted 2 times
...
snowfox
2 years, 10 months ago
So, the answer is C? So, Accept header sent was NOT application/xml. But, The Content-Type header sent was application/xml. So the system showed an error message because contect was application/xml?
upvoted 1 times
...
Tannhaus
2 years, 10 months ago
Selected Answer: A
I think it's A
upvoted 1 times
...
Jared28
2 years, 10 months ago
Selected Answer: B
As per the practice exam in: CCNP: ENCOR: 350-401: CCNP ENTERPRISE: Cisco Certified Network Professional: Implementing and Operating Cisco Enterprise Network Core Technologies (ENCOR)
upvoted 1 times
...
winder
2 years, 10 months ago
Selected Answer: A
Guys, if you want to share your answer, make sure give "Chosen Answer" option to help others. Thanks
upvoted 2 times
...
bara_ken
3 years ago
Selected Answer: A
This is A
upvoted 1 times
...
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.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago