Architecture - Best Practices - To define Base URL of REST API as per environment (Dev/UAT/Prod)

Hi,

What is the best way to define Base URL of REST API? 

REST API URL contains machine name so it would be different from environment to environment. I have many such Integration objects. So i cannot hard code that machine name in all 50 REST API Integration objects. Also i can't use one constant which will cater to all REST API Integration object.

Known solution: Create base constant that is environment specific (Tick - Different environments need to have different values for this constant). Create other 50 constants for fixed REST URL content. Finally in REST integration append base constant with other constants while using.

  Discussion posts and replies are publicly visible

  • Certified Lead Developer
    in reply to Pravin Sawant
    Hi a quick question here to understand your requirement more clear.

    -- As per my understanding, you have couple of integration objects (50), may i know are all these integration objects connecting to different Web API's / Services (either internal or external services)?

    if No, then why don't you create a connected system object and use this under your integration objects and select Inherit Base URL radio button, hence Appian will inherit the Base URL from the Connected System and relative URL can be provided under the Integration Object.

    As you are aware, while migrating from one environment to another (like Dev to Test) Relative Path of an API doesn't change, the only thing which changes i.e. Base URL and their respective credentials and this can be resolved using Connected System.

    Also when you export this connected system, generally you will get a link to download the customization file, where you will need to un-comment their each property(url, username, password etc..) and provide their respective values, which can be later used while importing this object into some other environment.

    In this way, by performing few amount of changes during the deployment, you will be able to update the url's of your Integration Objects.
  • Thanks Alok. I need to access data using Integration Objects i.e. REST APIs. I can't configure database into Appian. So i must have to use REST APIs. So the path http://<MachineName><portNo>/api/Client

    So here for all 50 Integration objects I need to hardcode MachineName in URL so i need best way to handle this situation.

  • Hi Pravin,
    As Alok highlighted, you could achieve this through the use of a connected system. In the connected system you can define the base url: docs.appian.com/.../Connected_System_Object.html
    The connected system will now show up in your properties file allowing you to define it for the environment during import.

    Within the integration object you select the new connected systems as the connection details to use and select the "Inherit Base URL" option .
    This will open a field for "Relative path" which then allows you to then specify a specific endpoint that's appended to the connected system's base url.
    docs.appian.com/.../Integration_Object.html

    This setup should allow you to manage the whole environment's base urls within the connected systems and only manage the stubs in the integration object.
  • Thanks Domen Jemec. In 18.1 Base URL feature is not available.