REST Calls from Alfresco Process Editor in JSON format

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

REST Calls from Alfresco Process Editor in JSON format

I would like to create a REST call using the Alfresco Process Editor which needs to be in the following format:

https://addresscoverage-cd50.restdb.io/rest/addresssample?q={"STREET_NUMBER": ${streetnumber}}

 where ${streetnumber} is an input variable from a form in the model. e.g.

                https://addresscoverage-cd50.restdb.io/rest/addresssample?q={"STREET_NUMBER": 194}

This works fine in POSTMAN.(call also requires an x-apikey for auth in the header).

Is it possible to construct a URI in this form using the Alfresco Process Editor? 

Or can I edit the model XML to achieve the same thing ?e.g.

<activiti:string><![CDATA[https://addresscoverage-cd50.restdb.io/rest/addresssample]]></activiti:string>
<modeler:request-mapping xmlns:modeler="http://activiti.com/modeler" modeler:jsonPropertyName="q" modeler:jsonPropertyType=??? modeler:jsonPropertyValue=???

2 Replies
Highlighted
Established Member II

Re: REST Calls from Alfresco Process Editor in JSON format

Hi,

    I would suggest to use java execution listener and in the listener you can call this Rest API using any java Rest client.There is a possiblity of passing parameters to the listeners.

Please Refer activiti documentation for further details Activiti User Guide 

you can also refer some of the examples on execution listeners in the sommunity

Martin Bergljung 

Highlighted
Member II

Re: REST Calls from Alfresco Process Editor in JSON format

Is it possible to construct a URI in this form using the Alfresco Process Editor?

If I add a request mapping like this, then  ${streetnumber} is just taken as text. 

create new request mapping

I need to be able to add some kind of delimiter to take ${streetnumber} as a variable. Something like (but not) this: " { &quot STREET_NUMBER &quot : " && ${streetnumber} && "}" 

I also thought I might also be able to construct a JSON template that looks like this:

{
"STREET_NUMBER": ${streetnumber}
}

.. but then I am missing the Property Name "q", so this doesn't work either.