Skip to main content
mayureshs5149
New Participant
September 24, 2026
Question

302 Redirect not working from Web API when invoked via Integration in a Dynamic Link

  • September 24, 2026
  • 7 replies
  • 33 views

Hi everyone,

I am trying to implement a seamless "Audit and Redirect" feature across different Appian sites in the same environment. As a developer, I do not have direct access to all the target sites, so I am storing their URLs dynamically in a database lookup table.

My Current Approach:

  1. From an interface, the user clicks a link component.
  2. This invokes an Integration object that calls a custom POST Web API.
  3. The Web API triggers a!startProcess() to write the audit data to a table.
  4. Upon process start (onSuccess), the Web API attempts to perform a HTTP 302 redirect by passing the target lookup URL into the Location header.

The Issue:
The audit data is successfully captured in the database table every time. However, the browser does not redirect the user to the target URL, and the user remains on the same page.

Here is a snippet of my Web API onSuccess configuration:

onSuccess: a!httpResponse(
  statusCode: 302,
  headers: {
    a!httpHeader(
      name: "Location",
      value: http!request.headers.url /* Dynamic URL retrieved from context */
    )
  },
  body: if(
    a!isNotNullOrEmpty(fv!processInfo),
    a!toJson(fv!processInfo),
    null()
  )
)
 

7 replies

stefanhelzle0001
Brainy
September 24, 2026

A redirect is something the browser needs to do. An integration object cannot do that.

mayureshs5149
New Participant
September 24, 2026

Hello ​@stefanhelzle0001 ,

Thank you for your prompt response.

is my code snippet correct? could you please elaborate your response? how do I redirect using a browser?

stefanhelzle0001
Brainy
September 24, 2026

You can only link to GET APIs. You will not be able to write any audit data, but your dynamic redirect should work.

stefanhelzle0001
Brainy
September 24, 2026

That link is not meant to do any navigation.

The documentation says: “Defines a link that triggers updates to one or more variables. Links can be used in charts, grids, hierarchy browsers, images, link fields, milestones, pickers, and rich text.”

What you might want to do, is to use a safeLink pointing to the Web API.

mayureshs5149
New Participant
September 24, 2026

Thank you ​@stefanhelzle0001, it is now working with safeLink

mayureshs5149
New Participant
September 24, 2026

For anyone following this thread or looking to implement a similar solution, here is the proper syntax for calling a GET Web API directly from an Appian interface using a!safeLink() and urlwithparameters():

Interface:

a!safeLink(
  label: "Download / View Report",
  uri: urlwithparameters(
    path: cons!MY_WEB_API_URL, /* Replace with your Web API URL constant or text path */
    parameterNames: { "param1", "param2" },
    parameterValues: { ri!value1, ri!value2 }
  ),
  openLinkIn: "NEW_TAB"
)

 

GET WEB API:

a!localVariables(
  local!url: http!request.queryParameters.url,
  local!user: http!request.queryParameters.user,
  local!appId: http!request.queryParameters.appId,
  a!httpResponse(
    statusCode: 302,
    headers: {
      a!httpHeader(name: "Location", value: local!url)
    },
    body: {
      rule!/*call integration to post the data using GET WEB API*/(user: local!user, appId: local!appId)
    }
  )
)