Handling Method Variations in a Single Appian Web API Object

Certified Associate Developer

Hi Community,

 

I am working on a POC where a third-party system interacts with my Appian Web API. The setup involves the following:

1. The third-party system is configured to call my API endpoint: https ://appianCloud.com/suite/webapi/endpoint1 for a GET operation to retrieve data using query parameters.

2. In subsequent calls, the system appends /action or /response to the same endpoint URL and performs a POST operation to modify the data for the same record.

 

Given this requirement, I would like to know:

• Is it possible to handle this type of scenario within a single Appian Web API object?

• If not, are there any known workarounds or best practices to manage such dynamic operation variations?

 

Looking forward to your insights. Thank you in advance!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    Hi    
    Thanks for your replies!

    Actually, in my current case I will not be able to create separate API for each endpoint. The reason for same is below:

    External system has a predefined UI and for each click we need our APi to respond.

    Now let say our API endpoint is /endpoint1. The web API URL will be: www.appiancloud.com/suits/webapi/endpoint1.


    First Request:
    request URL: www.appiancloud.com/suits/webapi/endpoint1/alldata
    In first request it will fetch list of records based on some query parameters (if provided)

    response:

    [
    {
    "id": "ID1",
    "Name1": "Customer 1",
    "Customernum": "3",
    "Street1": "Line 111",
    "Street2": "740",
    },
    {
    "id": "ID2",
    "Name1": "Customer 2",
    "Customernum": "2",
    "Street1": "Line 111",
    "Street2": "740",
    },
    {
    "id": "ID3",
    "Name1": "Customer 3",
    "Customernum": "3",
    "Street1": "Line 111",
    "Street2": "740",
    }
    ]

    This list of data will be showed in 3rd part systems UI

    Now if an end user clicks on any specific record in the 3rd party system. That particular data will be showed to the user and in that case request/response will look like below

    ------

    Second Request:
    Request URL: www.appiancloud.com/suits/webapi/endpoint1/data/{"id"}

    Response:
    {
    "id": "ID2",
    "Name1": "Customer 1",
    "Customernum": "2",
    "Street1": "Line 111",
    "Street2": "740",
    }

    Up till here it is following only GET method. Now according to the requirement there should options to perform certain actions on the specific record.
    In this case request will look like below

    ------

    Third Case:
    Request URL: www.appiancloud.com/suits/webapi/endpoint1/data/{"id"}/action
    Request Body: {
    "name1": "updatedName"
    }

    response:
    {
    "id": "ID2",
    "Name1": "updatedName",
    "Customernum": "2",
    "Street1": "Line 111",
    "Street2": "740",
    }

    PS: Above is just a high level of the requirement I am working on. Please let me know if you have any suggestion on this!
    Thank you!

  • +1
    Certified Lead Developer
    in reply to Shantanu Joshi

    You can create multiple API objects on the same endpoint, as long as the method is different.

    Then, in that objects, you route the call to separate expressions, depending on the path. In these expression, you do whatever is required.

Reply Children
No Data