Example Two – Extract Stock Information from a Website

In this example, we describe how to create a data access link to look up the asking price for stocks using the API from https://intrinio.com. This example uses basic authentication.

Configure Basic Authentication

To create authentication:
  1. From the Navigation menu, browse to Data Adapters > Authentication.

  2. On the List page toolbar, click the New New Button button and follow the instructions outlined in Configuring Basic Authentication to configure authentication using the username and password generated from https://intrinio.com. Name this example authentication “Intrinio Basic Auth”.

Create the Access Link

To create a link:
  1. From the Navigation menu, browse to Data Adapters > Access Links.

  2. On the List page toolbar, click the New New Button button. 

  3. On the Properties page, on the General tab, provide the following details.

    1. Name: Type the name as Stock rates.

    2. Type: Type is set to Web Services - RESTful and cannot be changed.

    3. Method: Set the method as Get.

  4. Select the Input tab and provide the following details.

    1. URL: Type the URL

      https://api.intrinio.com/data_point?identifier=<%ticker_sym%>&item=ask_price.

      The <%ticker_sym%> sets up the dynamic variable that needs a value every time this access link is executed.

    2. Authentication: Select the example “Intrinio Basic Auth”  you just created for https://intrinio.com.

    3. Accept: Set as application/json.

    4. Content-Type: Set as application/x-www-form-urlencoded.

  5. Select the Output tab, click the New button. A new window Create Output Format opens.

  6. In the Create Output Format window, provide the following details:

    1. Extract Or Filter: Select Extract.

    2. Path: Set as $.identifier.

    3. Internal Field Name: Provide the name as Stock Symbol.

    Click the Done button to return to the Output Format page. In the Output JSON Format space, the value of the Field Order field is automatically updated as 1. Then click the New button and in the Create Output Format window, provide the following details:

    1. Extract Or Filter: Select Extract.

    2. Path: Set as $.value.

    3. Internal Field Name: Provide the name as Ask Price.

    Click the Done button. In the Output Format JSON space, the value of the Field Order field is automatically updated as 2

  7. Click the Save button.

  8. Once you have returned to the Access Links list, select the Stock Rates link you just created.

  9. Click the Test button. The Test Data Access Link window appears.

  10. In the Test Data Access Link window, type the ticker_sym as IBM.

  11. The Result tab then displays the stock price extracted from the website.