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

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

“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

Hi Solange,

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

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

      	<p>JsonOutput.toJson([tipoMensaje: 1, destinatarios: ["ssilva","vmondragon"]])</p>
      	</li>
      </ul>
      </li>
      <li>
      <p>But when changing the constat values to the business variables as it follows I get the same message as before:</p>
      
      <ul>
      	<li>
      	<p>import groovy.json.JsonOutput</p>
      
      	<p>JsonOutput.toJson([tipoMensaje: registro.tipoMensaje, destinatarios: registro.destinatarios])</p>
      	</li>
      </ul>
      </li>
      

    Thanks in advanced!