Calling Web API

Hi,

 

I have a Web API which Start a Process (To Generate a text document with request and response).

with(
a!startProcess(
processModel: cons!PG_TEST_DOCUMENT_GEN_PROCESS_MODEL,
processParameters: a!fromJson(
a!toJson(
http!request.queryParameters
)
),
onSuccess: a!httpResponse(
statusCode: 200,
headers: {
a!httpHeader(
name: "Content-Type",
value: "application/json"
)
},
body: a!toJson(
fv!processInfo
)
),
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"
}
)
)
)
)

I want to know how I can call this Web API in local variable within my expression rule.

Example:

with(

local!request:"sample request",

local!response:"A Rest based Web service call",

local!generateDocument: "Call web API to generate document"

)

Thanks

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to PGarg
    As per my understanding, whenever you have the requirement to work with Writer type Object (like. httpWrite() till 17.1 or some other function), you must need to have the User Interaction. I mean to say, it's mandatory for you to have an Interface and call this function inside bind() and pass the value for this using saveInto.

    But if you don't want to have an interface and want to execute/post some data to some service using POST call, you can try creating Custom Smart Service Plugin, that might do your job.
Children
No Data