Data Synchronization - API

  • Last update: September 09, 2024
  • Overview 

    Version 

    The setting items of API Input in the Data Synchronization node are the same as those of the API Input operator. For the functional changes, see the section "Version" of API Input.

    Application Scenario 

    Due to security concerns, direct access to the database is sometimes restricted, and data is made available through APIs. You can use APIs to extract data and store it in relevant databases in this case.

    FineDataLink provides two functions for API-based data fetching, with the following differences: 

    FunctionDescription
    The API Input function in Data Synchronization (introduced in this article)If the data to be returned by the API is in a JSON format that requires no complex parsing, you can refer to this article for API-based data fetching.
    The API Input operator in Data TransformationThe API Input function in Data Synchronization does not support further processing of the data fetched from the API. To achieve that, you should use the API Input operator to fetch the data and then use other operators for further processing. 

    Function Description 

    FineDataLink supports API-based data fetching. This article describes how to fetch data from an API using the Data Synchronization node.

    0909-1.png

    Must-Read Notes Before Use 

    1. Read API Input carefully to understand the prerequisites, usage restrictions, and descriptions of each setting item for fetching data from the API using FineDataLink.

    2. You can perform simple JSON parsing of the data fetched from an API under Data Synchronization > API Input and save the data to a database, a file system, or other places, as shown in the following figure. 

    The Expand Parsed JSON Data into a Two-Dimensional Table function in Return Value Processing has certain limitations compared with the JSON Parsing operator. For details, see API Input.

    Example 

    API Information Collection 

    This section takes the FineDataLink-released API as an example to introduce how to fetch data from an API using the API Input function in the Data Synchronization node.

    You can download the document and view the API informationapp_test_API Document.docx. This API is created using Data Service.

    TypeDescription
    Request URLhttp://192.168.101.211:10636/webroot/service/publish/ed8d4d8e-d6a8-48da-bcec-d5b0e2920b77/xx
    Content-Typeapplication/json 
    Request MethodPOST
    Content

    {
       "paging": {
          "pageSize": 10,
          "pageNum": 1
       },
       "params": [
       {
       "name": "name",
       "value": " "
       }
      ]
    }
    The request body includes a name parameter. Supplement the parameter value to call this API for data fetching

    Returned Content

    (No setting is required when you call the API. It can be used to verify if the call is successful.)

    {
       "totalNum": 1,
       "errCode": 0,
       "pageSize": 10,
       "pageNum": 1,
       "rowCount": 1,
       "message": "success",
       "data": [      
       {        
       "score": "",        
       "name": "",        
       "id": 0      
       }  
      ]
     }
    The data fetched is stored in the data field, which can be parsed. 

    Scheduled Task Setting 

    1. Create a scheduled task and drag the Data Synchronization node into it.

    2. Set the request method, the API URL, and the content of Body in the Data Synchronization node according to the API document, as shown in the following figure.

    (Optional) Enter $.data in the input box of Response Body Processing to parse the data field. Click Data Preview, as shown in the following figure.

    The fetched data without being parsed is shown in the following figure.

    3. Click Data Destination and Mapping, where you can store the fetched data in the database, as shown in the following figure.

    4. Set Write Method to Add.

    Effect Display 

    The log after the task runs is shown in the following figure.

    The database data is shown in the following figure.

    Practical Application of API-Based Data Fetching 

    For details about API-based data fetching, see Instructions on API-Based Data Fetching

    For details about examples of API-based data fetching, see Overview of API-Based Data Fetching.


    附件列表


    主题: Data Development - Scheduled Task
    Previous
    Next
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy