Integration with Choice

The flow starts with a POST request to /demo via a REST trigger.

Then, we have a Choice that will evaluate a condition:

If the condition in the JSON Path: $.model.Details[?(@['Random nonsense'] == 'New today')] is true, we will have:

  • The success message.

  • The status code 200.

If it is false, we will have:

  • The error message.

  • The status code 400.

 - from:
      uri: rest:post:/demo
      steps:
        - choice:
            otherwise:
              steps:
                - setBody:
                    expression:
                      constant:
                        expression: "Erro: ID não encontrado no corpo da solicitação"
                - setHeader:
                      expression:
                        constant:
                          expression: "400"
                      name: CamelHttpResponseCode
            when:
              - id: when-3527
                steps:
                  - setBody:
                      id: setBody-3556
                      expression:
                        constant:
                          expression: Sucesso
                  - setHeader:
                      expression:
                        constant:
                          expression: "200"
                      name: CamelHttpResponseCode
                expression:
                  jsonpath:
                    expression: $.model.Details[?(@['Random nonsense'] == 'New today')]
Thanks for your feedback!
EDIT

Share your suggestions with us!
Click here and then [+ Submit idea]