Hi All,
I have two APIs right now. POST webAPI and GET Webapi.
--POST API is taking two query params as input, doing a start process and returning some url in its body.
--In GET Api i want to fetch that url from POST APIs body. How can I pass the params to POST Api from my GET API to fetch the url as response in GET API?
Here is my current implementation in GET API:
a!localVariables( local!httpRequestBody:http!request.queryParameters, local!FormId: if( rule!GEN_IsNull(local!httpRequestBody), null, local!httpRequestBody.FormId ), local!formToLaunchParameters_txt: if( rule!GEN_IsNull(local!httpRequestBody), null, local!httpRequestBody.formToLaunchParameters_txt ), if( or( rule!GEN_IsNull(local!FormId), rule!GEN_IsNull(local!formToLaunchParameters_txt) ), a!httpResponse( statusCode: 500, headers: a!httpHeader( name:"Content-Type", value:"application/json" ), body:a!toJson( { error:"FormId or KeyInstn is missing" } ) ), a!httpResponse( statusCode: 301, headers: a!httpHeader( "Location", rule!LinkToLaunchForm(----------This is the POST API ) ) ) ) )
Discussion posts and replies are publicly visible
I am not sure I fully understand what you are trying to achieve, but find some examples in the documentation here: docs.appian.com/.../Designing_Web_APIs.html
Actually I am trying to execute a startprocess from outside appian for which I want to give just a url to client so that when they hit the url the startprocess should occur and a resulting user input task form inside that process model should get displayed to them.
To trigger the process model I have written a POST Webapi but to create a URL I need to have getAPI thats why I am trying to integrate these two to generate a url for client.
This is me, guessing: You want to put a button on an Appian interface to start a process and display the interface from that process to the user?
If this is the case, do you have any specific reason to not use a record action field or a start process link?
I have done it through httppost request. like this:
local!postRequest: httppost( endpoint: concat( cons!SITE_URL, cons!ENDPOINT ) & "Key=" & ri!Key headerNames: {cons!API_AUTHORIZATION_KEY}, headerValues:{cons!API_AUTHORIZATION_KEY_HEADER_VALUE} ),
local!postRequest: httppost( endpoint: concat( cons!SITE_URL, cons!ENDPOINT ) & "Key=" & local!Key headerNames: {cons!API_AUTHORIZATION_KEY}, headerValues:{cons!API_AUTHORIZATION_KEY_HEADER_VALUE} ),
and its working fine. Can you now tell how can I pass two query params here? Its working fine with only one param here but if I pass a second param aslo, it throws an error. I want to do something like this:
endpoint: concat( cons!SITE_URL, cons!ENDPOINT ) & "Key=" & local!Key & "FormId=" & local!FormId,
Is this from the plugin "Send HTTP Request"? If yes, please delete it. It is deprecated and not been updated in the last 6 years.
It is one of the functions available under Web and XML Extensions shared component - httppost
I did not find this plugin. Is this a recent one?
Its a WebService Expresion : httppost
and I am able to achieve what I required. I passed multiple parameters to my post request like this:
local!postRequest: httppost( endpoint: concat( cons!SITE_URL, cons!ENDPOINT ) & "KeyInstn=" & local!KeyInstn & "&FormId=" & local!FormId
I know that, but this is not a standard function in Appian and not a good way to do it.
Use integrations for such operations.
But the issue is even if i create integration for it, how we will use this integration outside appian? the use case here is that I want to trigger a process model that resides in appian from outside appian and as a result I want the response. Through Integration Its not achievable as its an appian object I cannot use it outside appian. but using the GET webapi and this httppost() function I am able to achieve this. what other option do I have apart from this?
So, while not recommended, you can do the following:
External System -> GET -> Appian Web API -> Appian Integration (*) -> POST -> Appian Web API
* Why not recommended? When you configure a POST integration you set the "Usage" parameter. When set to "Queries Data", you can call that integration from any Appian interface or Smart Service. When set to "Modifies Data", you can use it only inside a saveInto, a Smart Service, or inside a POST Web API. So you have to falsely configure it to "Queries Data" even if it starts a process that updates data in the system.