Read API

Updated at:

This topic describes how to use the Read API operator and its usage notes.

Purpose

The Read API operator accesses a specified API operation, parses the return value, and generates a temporary table. Subsequent nodes can then process this table.

Scenarios

Compute pipeline

Compute engine

Supported

Offline

ALL

Yes

Real-time

Blink

No

Online

Built-in

No

Instructions

Prerequisites

Register the API operation you need to access on the API Ingest page in the Data Center.

Request configuration

  • Request header/Request body

Request header and request body parameters are configured during API ingestion. In the Read API operator, you can configure the logic for each parameter in the expression box.

  • Return value mapping

Specify the path of the array to fetch from the JSON object by setting the 'Array Fetch' parameter. Then, specify the corresponding column names in the table.

Note

The data fetched from the return value must be an array.

The following code shows an example of a return value and its mapping configuration:

{
  "code":"SUCCESS",
  "data":{
    "pageSize": 20,
    "pageNum": 1,
    "list":[    // The array to fetch
      {
        "name": {
          "firstName": "Alice",
          "lastName": "Brown"
        },
        "age": 22,
        "email": "alice@example.com"
      },
      {
        "name": {
          "firstName": "Bob",
          "lastName": "Miller"
        },
        "age": 19,
        "email": "bob@example.com"
      }
    ]  
  }  
}

The generated data is as follows:

last_name

first_name

age

email_address

Brown

Alice

22

alice@example.com

Miller

Bob

19

bob@example.com

Notes

  1. The Read API operator runs in a Zerg Standalone container. Therefore, you must specify a Zerg Standalone engine at runtime.

  2. The timeout for the Read API operator is 10 minutes. Ensure that the data volume returned by the API operation is within a reasonable range.

  3. Only external API operations with the following content types are supported:

    • application/json

    • application/x-www-form-urlencoded

    • text/plain

  4. The relationship between the data write operation, the specified compute engine, and temporary storage is shown in the following table:

Compute engine

Temporary storage

Perform a write operation

Spark

Hive Storage

Spark

Spark

MySQL

MySQL

MySQL

-

MySQL

MaxCompute

-

MaxCompute

Hive

-

Hive

Postgres

-

Postgres

ADB PG

-

ADB PG