APIGEE-API-ENGINEER practice question 13 of 25

You are using the Apigee ExtractVariables policy JSONPath feature, and discover that the query is not returning the expected result for the payload you are providing What should you do?

Full set: 126 questions
Answer options
A: Check that the Accept header is set to text/json
B: Check that the Accept header is set to application/json.
C: Check that the Content-Type header is set to text/json
D: Check that the Content-Type header is set to application/json Correct answer
Correct Answer:
D. Check that the Content-Type header is set to application/json
Explanation

The Apigee ExtractVariables policy uses JSONPath to extract data from a message payload that is in JSON format. For Apigee's parser to correctly interpret the message body as JSON, the Content-Type header of that message (either the request or response) must be explicitly set to application/json. If the header is missing, incorrect, or set to another value (e.g., text/plain), the policy will not treat the payload as a JSON object. Consequently, the JSONPath expression will fail to find any matching paths, resulting in the query not returning the expected value.

Why Incorrect

A. The Accept header indicates the media types the client can process in a response; it does not describe the format of the current payload being parsed.
B. The Accept header is irrelevant for parsing the current message's payload. It is a client-side header used for content negotiation for the response.
C. While Content-Type is the correct header, text/json is an obsolete and non-standard media type. The official standard specified by IETF RFC 8259 is application/json.

References

1. Google Cloud Apigee Documentation

"Extract Variables policy": Under the element description

the documentation states: "The message must be parsed as JSON by Apigee. If the message is not valid JSON

or if the message is not parsed as JSON for other reasons (such as the Content-type header not being application/json)

the policy will not be able to extract any variables." This directly confirms that the Content-Type header must be application/json.

Source: Google Cloud Documentation > Apigee > Reference > Policies > Extract Variables policy reference.

2. IETF RFC 8259

"The JavaScript Object Notation (JSON) Data Interchange Format": This official standard defines the media type for JSON.

Section 11

"IANA Considerations": "The MIME media type for JSON text is application/json." This establishes application/json as the correct and standard value.

Scroll to Top