Skip to main content
February 20, 2025
Question

Call POST API from GET API

  • February 20, 2025
  • 14 replies
  • 0 views

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
        )
      )
    )
  )
)

14 replies

stefanhelzle0001
February 20, 2025

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

February 20, 2025

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.

stefanhelzle0001
February 20, 2025

Starting a process cannot be done using a GET. You will need some kind of client side logic or code that first makes a POST to Appian, and then somehow navigates the user to the returned URL.