Hi Folks,
I'm trying to achieve the following:
Any inputs would be great, as I'm just beginning, I can implement more efficient code.
Thanks in advance!!
Discussion posts and replies are publicly visible
Hi, Your web api code should be something like below: with( a!startProcess( processModel: cons!yourProcessModel, processParameters: a!fromJson( http!request.body ), onSuccess: a!httpResponse( statusCode: 200, headers: { a!httpHeader(name: "Content-Type", value: "application/json") }, body: a!toJson( {"Your Success Message"} ) ), onError: a!httpResponse( statusCode: 500, headers: { a!httpHeader(name: "Content-Type", value: "application/json") }, body: a!toJson( { error: "There was an error starting the process" } ) ) ) )
Hello,
Did you find a way to have the format correctly in variable?
It isn't possible to create process variable of "Dictionary" or "Any Type", so your best bet is to create a custom data type that matches the structure of this JSON request. Then, create a variable using that CDT and it will preserve the structure in your process variable.
Yes. Extracted the values from the request and assigned to Process parameter. This way you can get the actual request in JSON format in to the process model. Sample below.
Request :
{"Request":{"Attribute1":"value","payload":{"Attribute2_1":"value","Attribute2_2":{"Attribute2_2_1":"value","Attribute2_2_2":"value"},"Attribute3":"value"}}}
WebAPI:
a!startProcess(
processModel:cons!PM_NAME,
processParameters:
{
Attribute1:a!fromJson(http!request.body).Request.Attribute1,
payload:a!toJson(a!fromJson(http!request.body).Request.payload)
}
)