Create, Configure, and Call External APIs

External APIs are predefined collections of API calls that are executed in sequence within the same context, effectively turning FintechOS Studio into an API client with advanced capabilities.

Create External APIs

  1. Open FintechOS Studio in Developer mode and navigate to the Main Menu.
  2. Select Ecosystem > External APIs. This opens the list of external APIs.
  3. Click Insert to add a new External API. This opens the Add External API page.
  4. In the page that opens, enter a Code and, optionally, a Name for your External API.
  5. Click Save and Close.

This creates an empty External API. To add API calls to the External API, you need to configure the External API.

Configure External APIs

  1. Open FintechOS Studio in Developer mode and navigate to the Main Menu.
  2. Select Ecosystem > External APIs. This opens the External API List page.
  3. In the External API List, double click the External API you wish to edit. This opens the Edit External API page.
  4. In the External API Details grid:
    • To add a new API call to the pipe, click the Insert button.
    • To edit an existing API call, double click the API call from the grid.
  5. In the page that opens, fill in the API call's details and click the Save and Close button at the top right corner of the page when done. For details on how to set up an API call, see the following:

Call External APIs

To call a External API, use the FTOS_IntegrationProcessLibrary object and callIntegrationProcess method:

Copy
var integrationProcessId = FTOS_IntegrationProcessUtils.getIdFromCode("FTOS_IntegrationProcess", "code", restPipeCode);
var ip = new FTOS_IntegrationProcessLibrary();
ip.logEnabled = false;            
var response = ip.callIntegrationProcess(integrationProcessId, contextEntityName, contextUniqueId, requestParams, runAsync);
 

where:

ParameterDescription
integrationProcessIdExternal API ID based on the pipe's code (see Create, Configure, and Call External APIs for details).
contextEntityNameName of the entity for which the External API is run.
contextUniqueIdID of the contextEntityName record.
requestParamsIncludes static parameters and their values to be passed to each API call in the following format:
Copy
requestParams[External API code].[API call Order No.] = {[parameter 1]:[value 1], [parameter 2]:[value 2], ...};

For example:

Copy
requestParams["P01.01"] = {CUI: "36438401", CNP: "78787878"};
requestParams["P01.02"] = {CUI: "36438401", CNP: "78787878"};

These parameter values will be available in the API call's custom JavaScript code in the requestParamsBeforeJs object.

runAsyncIf set to true, runs the External API as an asynchronous process.
responseThe resulting response of the External API call will have the following format:
Copy
response:{
    "ipInstanceId": "523ee20b-705c-45b3-b881-caeec1bde15e",
    "isSuccess": true,
    "errorMessage": null,
    "mainResponse": {
        "P04.02": {
            "requestId": 89696.0,
            "errorMessage": null,
            "IsSuccess": true
        }
    }
}