Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 2 Next »

Introduction

PhixFlow allows you to integrate with various APIs to import data. To achieve this you will require three elements.

  1. HTTP Datasourceprovide the information needed to connect to an external source of data via HTTP. 
  2. HTTP Collector: Consumes the data from the HTTP Datasource.
  3. Table: Stores the data from the HTTP Collector.


Open Example

We will connect to the UK Government bank holiday API and return the bank holiday dates for England and Wales. See Bank Holidays for more detail on the API.


Solution

HTTP Datasource

  1. Drag a HTTP Datasource from the toolbar and drop it on the analysis canvas.
  2. In the properties window set the following:
    1. Name, Set a name indicative of the API.
    2. Enabled, Tick this option. 
    3. Connection Type, Set this to that of the API, in our example we will use HTTPS.
    4. HTTP Datasource Instances, Set the instance connection details. Add a new HTTP Datasource Instance and complete the details as follows:
      1. Name, Indicative of the use of the instance.
      2. Enabled, Tick to use the instance.
      3. Login details can be set if required. see HTTP Datasource for more information.
      4. URL, The URL where the API can be found. For the Gov Bank Holiday API we set this to: www.gov.uk/bank-holidays.json
      5. Click  Apply and Close.
    5. Click  Apply and Close.

HTTP Collector

  1. Hover your mouse over the HTTP Datasource created in the stage above.
  2. From the popup menu select  HTTP Collector. This adds a new HTTP Collector and sets it up to use our HTTP Datasource.
    1. You can drag a new HTTP Collector from the toolbar, but you will need to connect it to the HTTP Datasource.
  3. In the properties window that opens on the right set the following:
    1. Name, Set a name indicative of the data being collected. 
    2. Enabled, Tick this to use the collector.
    3. HTTP Request Method, This defaults to GET or POST. For our example that is correct. However see HTTP Collector for more information, if your API requires something different.
    4. Response → Return Type, In the response section set Return Type to JSON. Other types of data can be returned.
    5. ResponsePath, specifies the data in the JSON you with to return. Most APIs will specify the structure of the data returned, the path is used to filter what is returned. In our example we only want the bank holidays for England and Wales so we set the value to: NEED TO GET THIS FROM DEV   

Table

  1. Hover your mouse over the HTTP Collector created in the stage above.
  2. From the popup menu select  Create New Table 
    1. You can drag a new Table from the toolbar, but you will need to connect it to the HTTP collector.
  3. In the properties window that opens on the right set the following:
    1. Name, Set a name indicative of the data being collected. 
    2. Attributes, Add the attributes you require from your collected data. DO NOT set a pipe prefix, you can drill down your JSON path in an attribute using the JSON element as a prefix. For example: jsonElement.Value. In our example we set two attributes:
      1. Name to Title. Expression to title
      2. Name to Date. Expression to toDate(date, "yyyy-MM-dd")


Secured Example

coming soon.

  • No labels