Help Center> ROMA Connect> Developer Guide> Developer Guide for Data Integration> RESTful API Specifications of Connectors
Updated on 2022-09-01 GMT+08:00

RESTful API Specifications of Connectors

Data Reading API

API Specification Definition

  • URI

    POST /reader

  • API request
    {
        "job_name": "job_name",
        "datasource": {
            "para1": "******",
            "para2": "******",
             ...
        },
        "params": {
            "extend": {
                "ex_para1": "******",
                "ex_para2": "******",
                 ...
            },
            "pagination": {
                "offset": 1,
                "limit": "10"
            },
            "migration": {
                "begin": **********,
                "end": **********
            }
        }
    }
  • API response
    {
        "datas": [
            {
                "para1": "******",
                "para2": "******",
                 ...
            },
            {
                "para1": "******",
                "para2": "******",
                 ...
            },
            ...
        ]
    }

API Parameters

  • Request parameters
    Table 1 Request parameters

    Parameter

    Mandatory

    Type

    Description

    job_name

    Yes

    String

    Task name. The value can contain 4 to 64 characters, including letters, digits, hyphens (-), and underscores (_).

    datasource

    Yes

    Object

    Data source object. The JSON body consists of the parameters on which the connector depends to connect to the database and all parameters.

    params

    Yes

    Params

    Parameter object required by the connector.

    Table 2 Parameter description of params

    Parameter

    Mandatory

    Type

    Description

    pagination

    No

    Pagination

    Pagination object.

    migration

    No

    Migration

    Incremental migration object.

    extend

    No

    Object

    Extended parameters to which a connector belongs. The value is a JSON body consisting of extended parameters.

    Table 3 Parameter description of pagination

    Parameter

    Mandatory

    Type

    Description

    offset

    No

    Integer

    Offset from which the query starts.

    limit

    No

    Integer

    Number of records displayed on each page.

    Table 4 Parameter description of migration

    Parameter

    Mandatory

    Type

    Description

    begin

    No

    Date

    Start time of data migration.

    end

    No

    Date

    End time of data migration.

  • Response parameters
    Table 5 Response parameters

    Parameter

    Type

    Description

    datas

    List<Object>

    List of data to be read. The value of this parameter must be in JSON array format and is determined by the connector based on the site requirements.

Data Writing API

API Specification Definition

  • URI

    POST /writer

  • API request
    {
        "job_name": "job_name",
        "datasource": {
            "para1": "******",
            "para2": "******",
             ...
        },
        "params": {
            "extend": {
                "ex_para1": "******",
                "ex_para2": "******",
                 ...
            }
        },
        "meta-data": [
            {
                "name": "id",
                "type": "String",
                "format": "",
                "path": "datas[i].id"
            },
            {
                "name": "company",
                "type": "String",
                "format": "",
                "path": "datas[i].company"
            },
            ...
        ],
        "datas": [
            {
                "data1": "******",
                "data2": "******",
                 ...
            },
            {
                "data1": "******",
                "data2": "******",
                 ...
            },
            ...
        ]
    }
  • API response
    {
        "num_success": "2",
        "num_fail": "0",
        "fail_datas": [
            {}
        ]
    }

API Parameters

  • Request parameters
    Table 6 Request parameters

    Parameter

    Mandatory

    Type

    Description

    job_name

    Yes

    String

    Task name. The value can contain 4 to 64 characters, including letters, digits, hyphens (-), and underscores (_).

    datasource

    Yes

    Object

    Data source object. The JSON body consists of the parameters on which the connector depends to connect to the database and all parameters.

    params

    Yes

    Params

    Parameter object required by the connector.

    meta-data

    Yes

    List<Meta-data>

    Metadata parameter list.

    datas

    Yes

    List<Object>

    List of data processed by the connector.

    Table 7 Parameter description of params

    Parameter

    Mandatory

    Type

    Description

    extend

    No

    Object

    Extended parameters to which a connector belongs. The value is a JSON body consisting of extended parameters.

    Table 8 Parameter description of meta-data

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Data field name.

    type

    Yes

    String

    Data field type. The value can be String, Integer, Date, or Long.

    format

    No

    String

    Format string of data. Format of a character string. This field needs to be specified when type is set to Date.

    path

    Yes

    String

    Path of a field in the source data.

  • Response parameters
    Table 9 Response parameters

    Parameter

    Type

    Description

    num_success

    Integer

    Number of times data is successfully written.

    num_fail

    Integer

    Number of times data failed to be written.

    fail_datas

    List<Object>

    List of data that fails to be processed.