Hi,
I want to get the query parameter and want to send it in the request body in post request. But I am getting error with assign message policy.
My Extract variable policy is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract-Variables-1"> <DisplayName>Extract Variables-1</DisplayName> <QueryParam name="date1"> <Pattern ignoreCase="true">{date2}</Pattern> </QueryParam> <Source clearPayload="false">request</Source> <VariablePrefix>queryinfo</VariablePrefix> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> </ExtractVariables>
My Assign message policy is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Message-1"> <DisplayName>Assign Message-1</DisplayName> <Set> <Payload> <ExtractQP>{queryinfo.date2}</ExtractQP> </Payload> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> </AssignMessage>
My request is:
http://organisation.apigee.net/analytics/response-code?date1=01/20/2018
My error is:
Error:InvalidRequestContentException: Could not parse request body into json: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: [B@1e2d42a4; line: 1, column: 2]
Solved! Go to Solution.
Looks like you are sending an XML payload with to the backend with a Content-Type of application/json.
In your assign message you can also set <Header name="Content-Type">application/xml</Header> and if the backend supports xml, this should fix the error. Otherwise you can build JSON instead.
Hope this helps!
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |