Configure access to third party APIs
  • 17 Aug 2019
  • 1 Minute To Read
  • Contributors
  • Print
  • Share
  • Dark

Configure access to third party APIs

  • Print
  • Share
  • Dark

To be able to integrate your App to an API outside of FrontM, you first need to add the API metadata to the API library of your domain. The metadata contains the following information:

Field Name Description Example
userDomain The company that the API belongs to frontmai
serviceName A unique name to identify the service GetVesselDetails
format The format the API returns the data in. Only JSON is supported now JSON
method The HTTP method to call the service (GET/PUT) GET
serviceUrl The base url of the service without any query parameters
allowedInputs This is a JSON object that defines the way to call the API. It has 4 fields: body, header, pathParams and queryParams. The value of the properties can either be true or false. In the example, the GetVesselDetails service adds only path parameters while calling the service. { body: false, header: false, pathParams: true, queryParams: false }
apiKeys If the service uses any sensitive information in its call, like api keys or tokens, this field can be used to store it securely in the DB instead of hardcoding it in the app. This is a JSON object that has a set of key and value pairs. { key: secretKey}
template This is a JSON object that can be used to replace any sensitive information, or for defining constants that needs to be present in the call. It has 4 fields: body, header, pathParams and queryParams. The values are defined templates. In this example, the key defined in apiKeys.key and the constant 'param1' will be added to the final path url. { pathParams: "<%=key%>/param1" }

You add the metadata using the AppPublisher App described in the Development Tools section.

Once the API is added to the system, you can call the API as in the example below:

  spireAPI.onResolution = async () => {
    let queryParams = 'queryParams';
    let header='header';
    let pathParams = 'pathParams';
    let body = 'body';
    return state.api
      .callService(SPIRE_SERVICE, { 
      .then(response => {
            //Process response

Was This Article Helpful?