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
  • @Santosh

    Being on Appian 17.2, I am using Integration Object to call Web API but getting some absurd response.

    Still this will not resolve or provide actual solution because AFAIK POST method will be used in this case as I am starting a process to modify something and Integration object can only be called in saveInto parameter, but in my case I need to call this Web API in expression rule (load or with) to start the process.

    I don't have any SAIL form for user intervention

    Thanks
Children
  • 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.