Step-By-Step Guide to Use Rest API to Retrieve  Details of a Global Company

Let us consider the API of Finnhub.io to access the company details of a global company like Apple or Microsoft.

API URL: https://finnhub.io/api/v1/stock/profile?symbol=<symbol of the company>&token=<API authentication key>, where the base URL is https://finnhub.io/api/v1/stock/, input path is profile and query parameter is symbol=<symbol of the company>&token=<API authentication key>

 

Prerequisite:

  1. In the Admin menu, add a WebAPI application.
  2. In the Application Properties panel:
    • Enter the Login URL as https://finnhub.io/api/v1/stock/
    • Select the Type as REST
    • Enter the Application Description, Display Name, and the Application Name
  3. Click the (Save Properties) icon to save the application details.
    The REST WebAPI application is created.

 

To automate the process of retrieving company details:

  1. Create a new process.
  2. In the Parameter bar:
    • Create In arguments and define their respective values:
      • Profile, to store the input path-profile
      • Symbol, to store and pass the companyy name- AAPL as the input
      • Token, to store and pass the authentication token as the input.
    • Create an Out argument, CompDetails to store the API output.
  3. From the Canvas Tools panel, add the Rest API Activity to the Flowchart designer on the Canvas.
  4. In the Properties pane of the Rest API Activity (available on the right hand side), set Methods as Get.
  5. In the Select Rest API list, select the available Rest API.
  6. In the Api Path list, select the Profile argument created above.
  7. Click the (Settings) icon, and then click UrlParams. The API Params dialog box appears.

 

 

  1. Click Add and then enter a name of the company symbol parameter.
  2. In the Value list, select Symbol argument created above.
  3. Click Add and then enter a name of the authentication token.
  4. In the Value list, select Token argument created above.
  5. Click Confirm.
  6. In the Parameter bar, provide a value to the Symbol and Token arguments respectively. This sets the values as default value of the query parameter.
  7. Click the (Settings) icon, and then click Input Mapping.
  8. In the Output list, select the CompDetails argument to store the details of the company retrieved by the API. You can use CompDetails to pass the data to another activity for further processing.

To view the output of this example, add the Writeline activity that prints the information on the console.

  1. Add Writeline activity and in the Text field, write CompDetails.

 

 

  1. Setup the environment and then perform test run.
    The Output console displays the XML response received from the API. You can use the XML activity to view the details as per your requirement.