Validate API response body

I’ve a outgoing configuration to a API, that’s gives a 200 OK response
the body instead does have the status (Processed or Error) as a array.

I tried to set-up a validator, but without any documentation, is really complex.

So, for example I got the next Body:

{
  "Header": {
    "Version": "1.0",
    "Identification": "1234567890",
    "Sender": "some-secret-key"
  },
  "Result": [
    {
      "CompanyIdentifier": "13",
      "OrderIdentifier": "1234567890",
      "ProcessingStatus": "E",
      "SalesOrderImportResult": "Can't import Sales Order. SO already in progress."
    }
  ],
  "Footer": {
    "TotalRecords": 0,
    "Records": 0
  }
}

I’ve added a plug-in ‘Validate the response’

  1. Validate message body
  2. Evaluate filter
  • Value Condition
  • Pattern accessor
  • Pattern: Result.*.ProcessingStatus
  • Does not equal: string “P”

Right now this is one of the 5 solutions i tried already, but whatever i try, it fails always like:

Failed: Require all validations to pass

  • Failed: Require all items to validate
    • Failed: Require all validations to pass
      • Failed: Error processing order

so, is there any howto/manual or example ? or maybe someone can explain howto achieve this

Hi @TMourikSH,

Could you please try to change the plugin ‘Validate the response’ to this:

  1. Validate message body
  2. Aggregate: Require no validation to pass
  3. Evaluate filter
  • Value Condition
  • Pattern Accessor
  • Pattern: Result.*.ProcessingStatus
  • Equals: string “E”

Please let me know if it doesn’t work.

Nope, no solution.
But, ‘require no validation to pass’ isnt that strange ?

Hi @TMourikSH,

Thank you for confirming.
So, please change to this:

When the response is “E”, the task will fail, and the logs will be like this:
image

And when it’s “P”, the task will continue to be processed.
Also, please make sure that the pattern is correct (without white space).

I checked both options (again); especially the space in the pattern :wink:

But non of both options works

That’s strange.
Could you please create a support ticket? So that we can provide you with the example specific to your environment.

1 Like