Cannot send variables (process, business or local) in REST API connector payload

1
0
-1

Hello!

I'm trying to send variables from the process to a REST API on the payload.

When I put the data as a constant it all works fine, I get a response.

Bu if I use a variable, business, process or local, it won't work. I get the following message:

"Unsupported expression type for testing: Input parameter 'body' uses an unreachable Expression"

I tried using a groovy script but the same happens: when using the constanta data it works fine, if I change it to a variable I get the same error.

Hope somebody can help me!

Solange Silva

Comments

Submitted by romain.bioteau on Sat, 04/24/2021 - 11:31

Hi Solange,

Can you share the groovy expression used to generate your dynamic payload ?

Submitted by ssilva_bizpro on Mon, 04/26/2021 - 18:19

Hello romain.bioteau!

Of course:

  • On the default payload editor, as a constant I send the following JSON and get a correct response:
    • {"tipoMensaje": 4,
      "destinatarios": ["ssilva1","ssilva2"]
      }
  • When trying to use variables it won't even send the request, I've tried the following and got the message "Unsupported expression type for testing: Input parameter 'body' uses an unreachable Expression" as stated:
    • {"tipoMensaje": ${registro.tipoMensaje()},
      "destinatarios": ${registro.destinatarios()}
      }
    • {"tipoMensaje": ${registro.getTipoMensaje()},
      "destinatarios": ${registro.getDestinatarios()}
      }
  • On the groovy script, if using the following JSON I get a correct response:
    • import groovy.json.JsonOutput

      JsonOutput.toJson([tipoMensaje: 1, destinatarios: ["ssilva","vmondragon"]])

  • But when changing the constat values to the business variables as it follows I get the same message as before:

    • import groovy.json.JsonOutput

      JsonOutput.toJson([tipoMensaje: registro.tipoMensaje, destinatarios: registro.destinatarios])

Thanks in advanced!

1 answer

1
+1
-1
This one is the BEST answer!

"Unsupported expression type for testing: Input parameter 'body' uses an unreachable Expression"
Only happens when using the `Test connector` feature. When using Test connector (outside of a process execution) using variable references is not possible and the above message is displayed.

Your expression should work when executing the process.

HTH
Romain

Notifications