The Rest API connector transforms data to a flattened JSON format. Specifically, the connector flattens all nested data into a single layer of key pairs in a single table.
Note

The maximum JSON result is 10 MB and the data cannot have more than 1,000 columns.

Set up a new connection

Complete the following steps to set up a connection in Minitab Connect.
  1. From the Home screen, select the Add button under Tables.
  2. In Datasets, enter Rest API and select the connector from the results.
  3. Enter a Name that identifies the connection.
  4. In Variables, enter up to 15 key-value pairs to store and reuse values. Enter the key in the first box, and the value in the second. The key name is limited to 100 characters and can only contain letters, numbers, hyphens (-), and underscores (_). The connector validates and executes the value as a SQL statement if starts with a left parenthesis and end with a right parenthesis.

    When you store a value as a variable, you can reference it multiple times and only have to update it in one place. For example, if you have the same URL in more than one request, but the URL might change, enter base_url as the key. Then, enter www.example.com as the value and use {{base_url}} to reference the variable in your requests. If the URL changes, you can change the value of base_url to update the new URL across all your requests using the same connection automatically.

  5. From Authentication, select one of the following options.
    Basic Authentication
    Enter the credentials for the RESTful web service.
    API Key/Token
    Enter the API key and value. From Desired Authentication Parameter Type if you select Header Parameter you can make GET and POST requests. If you select Body Parameter you can only make POST requests.
    Bearer Token
    Enter the Token.
    JWT Token
    Select to generate JWT tokens and add them to the request. From Desired Authentication Parameter Type if you select Header Parameter you can make GET and POST requests. If you select Body Parameter you can only make POST requests.
    From Algorithm, select either a HS, RS, or ES algorithm. If you select HS, enter a Secret to use with the algorithm. If you select RS or ES, Connect creates a JWT Public Key after you save the connection.
    OAuth 2.0
    Select to access data with OAuth 2.0. For more information about the options for this authentication method, go to the Set up a new connection with OAuth 2.0 section.
    None
    Select if your web service does not require a username and password or an API key
  6. Select Save .

After you save the connection, Connect displays options to import data into a new table. Start at step 4 of the Create a table with data from a connection section for more information on importing data to create a table.

Set up a new connection with OAuth 2.0

Complete the following steps to set up a connection in Minitab Connect with the OAuth 2.0 authentication method. Accessing data with OAuth 2.0 usually involves a few requests back and forth between Connect and the API.
  1. From the Home screen, select the Add button under Tables.
  2. In Datasets, enter Rest API and select the connector from the results.
  3. Enter a Name that identifies the connection.
  4. From Authentication, select OAuth 2.0.
  5. From Desired Authentication Parameter Type if you select Header Parameter you can make GET and POST requests. If you select Body Parameter you can only make POST requests.
  6. From Grant Type, select one of the following options.
    Authorization Code
    Select to authenticate with the API service provider. An authorization code is sent back to the client app, extracted, and exchanged with the provider for an access token to authenticate future requests.
    Implicit
    Select to return an access token without requiring the extra authorization code step. This makes it less secure.
    Password Credentials
    Select to send a username and password directly from the client. If you select this grant type, you have to enter the Username and Password for your API provider.
    Client Credentials
    Use to access data associated with the client application.
  7. The following is the full list of options to request a new access token. They depend on your grant type.
    Callback URL
    You must add this URL to your application's registered Callback URLs.
    Auth URL
    Enter the endpoint for the authorization server that you want to use to get the authorization code. Include any non-standard parameters that the service requires.
    Access Token URL
    Enter the endpoint for the authorization server that you want to use to get the access token.
    Refresh Token URL
    Enter the endpoint for the authorization server that you want to use to refresh the access token if it is different than the Access Token URL.
    Client ID
    The ID for your client application that you registered with the API provider.
    Client Secret
    The client secret you received when you registered with the API provider.
    Scope
    The scope of the access request. Separate multiple scopes with a space.
  8. If you selected Authorization Code or Implicit as your grant type, you must select Click to authorize before you can save the connection.
  9. Select Save .

After you save the connection, Connect displays options to import data into a new table. Start at step 4 of the following section for more information on importing data to create a table.

Create a table with data from a connection

Complete the following steps to import a data file from an API and create a new table in Connect. If you use a variable in an input box, you can hover over the variable to view the value. However, you can only reference a variable in the table setup, not in the connection. You must define the variable and save the connection to reference a variable. For more information, see step 4 in the "Set up a new connection" section.
  1. From the Home screen, select the Add button under Tables.
  2. In Datasets, enter Rest API and select the connector from the results.
  3. Under Connection, select the Rest API connection that you previously set up. If you have not previously set up a connection, select New Connection and follow the steps in the previous section.
  4. On the left panel, enter a Name that identifies the table and select a Folder to save the table.
  5. Under Update Frequency, specify how often you want Connect to update the table. You can import the data one time or have Connect continuously import the data at a set time interval. Connect automatically creates a flow for your import. If you select Once, you can use the flow at a later time to automatically run the import again.
  6. Under URL, enter the base request URL. You'll add parameters later.
  7. From Request Type, select either a HTTP GET request or a HTTP POST request.
  8. In Maximum Array Depth, select the maximum depth in which Connect converts JSON data nodes into table columns. The JSON string data becomes the cell value result when Connect reaches the maximum depth. By default, the maximum array depth is 5.
  9. Select Next.
  10. In Request Header Parameters and Request Body Parameters , enter the request parameters that you want to send. If you use a variable, you can hover over the variable to view the endpoint for the URL.
  11. No fields are available initially. Select Add Parameter to add key pairs to the request URL parameters.
  12. In Array Key for Records (Root Path), enter the comma separated path to the node.
  13. Select The response separates records across multiple pages to add paging variables. Then, from Paging Variable Configuration, select one of the following options. With either option, you can parse a maximum of 100 pages.
    Next Page Link Parameter
    Use when you continue from the previous API response and page through results one page at a time. The Page Parameter Name must be a comma separated list of keys. These keys find the next page link in the response. For example, "info,next".
    Page Parameter and Starting Page Number
    Use when you want direct access to a known page number. Then enter the Page Parameter Name and the Starting Page Number.
  14. Select Save . If you go to the Prep Tool and select Run , Minitab Connect displays the imported data.
    Note

    If no data appears after you select Run, select Reset Config .

When you save the import, Connect creates a flow with the settings that you selected. For more information on how to schedule a flow and add more data processes to clean data, go to Overview of the Flow Tool .

JSON Flattening Logic

Connect flattens the JSON results to properly represent them as a table. Flattening means to put the JSON into a single hierarchy structure so that there are no child or parent objects. Columns can then be represented since everything is a key-value pair. Nested objects are displayed by a dot operator in the column name.