I am facing an issue while extracting the variables in negative scenario. Below is my response format which i got from trace , {"message":"Id '2337' not found.","codeDescription":"NotFound","code":"*****"}.I am unable to extract any of those variabls in extract policy and the extract policy is not coming in the trace. The same thing is working for positive scenario. The extract policy is visible in trace and able to see the variable in trace. I checked the content-type - it is application/json . Please help out.
Solved! Go to Solution.
By default, Apigee Edge treats HTTP code 4XX or 5XX as errors, and it treats HTTP code 1XX, 2XX, 3XX as success.
If you want to add HTTP code 4xx to the list of default success codes, set this property in the Target End point proxy config as:
<Property name="success.codes">1xx,2xx,3xx,4xx</Property>
More info here
Once you have added that to your proxy config, then the policy to extract the response for negative scenarios will get executed. You should be able to trace this. The default behavior is that it will throw an error if the target system returns a 4xx which will by pass your policies in the Response flow.
Try this out and let me know if it works.