JN0-224 practice question 3 of 15

You are asked to use the REST API to retrieve interface configuration information from your Junos device. You decide to use a cURL HTTP GET command to retrieve this information. In this scenario, which two statements are correct? (Choose two.)

Full set: 66 questions
Answer options
A: You can retrieve this data in HTML or JSON formats.
B: You must have SSH enabled on the Junos device.
C: You can retrieve this data in XML or JSON formats. Correct answer
D: You must Include the authentication Information with each request. Correct answer
Correct Answer:
C. You can retrieve this data in XML or JSON formats.; D. You must Include the authentication Information with each request.
Explanation

The Junos REST API is a stateless interface, meaning each request must be independently authenticated. This is typically done using HTTP Basic Authentication, where credentials are sent in the Authorization header of every API call. The API is designed for programmatic interaction and returns structured data. By default, the output is in XML, which is the native format for Junos configuration. However, you can request the output in JSON format by setting the HTTP Accept header to application/json, making both XML and JSON supported formats for retrieving configuration data.

Why Incorrect

A. The Junos REST API returns structured data formats like XML and JSON, not a presentation format like HTML for configuration information.
B. The REST API operates over HTTP or HTTPS and is configured under [edit system services rest]. It is independent of the SSH service.

References

1. Juniper Networks TechLibrary, REST API Guide, "Specifying the Output Format for REST API Requests": This document states, "By default, the REST API returns data in XML format. You can, however, request that the data be returned in JavaScript Object Notation (JSON) format... To specify the output format, include the appropriate value for the Accept header in the request." It lists application/xml and application/json as the primary values. This supports option C and refutes A.

2. Juniper Networks TechLibrary, REST API Guide, "Authenticating REST API Users": This section clarifies the authentication mechanism: "The Junos OS REST API uses HTTP Basic Authentication to authenticate users for each API request... The client is responsible for including the Authorization header in all REST API requests." This directly supports option D.

3. Juniper Networks TechLibrary, REST API Guide, "Enabling the REST API": This guide details the configuration required to enable the REST API service, which involves setting set system services rest http or https and does not mention any dependency on the SSH service. This refutes option B.

Scroll to Top