API Input - Paginated Data Fetching

  • Last update: October 12, 2024
  • Overview

    Version

    FineDataLink Version

    Functional Change

    4.1.3

    /

    Application Scenario

    When using FineDataLink to fetch API data, sometimes you need to enable Paginated Data Fetch due to data volume or response time limitations. 

    Function Description

    FineDataLink provides the Paginated Data Fetch function for APIs.

    If you choose API Input as Data Source of the Parameter Assignment node or the Data Synchronization node, you can enable Paginated Data Fetch in Advanced Configuration and fetch data according to the pagination method set on the page, as shown in the following figure.

    Restriction on Use

    This function is valid currently for JSON-formatted API responses only.

    Function Description

    iconNote:

    The execution logic of Pagination End Condition no matter which pagination method is selected is to execute the loop object first and then determine whether to terminate the loop. For example, suppose you set Pagination End Condition to ${pageNum}>=totalpages. When the values of totalPages and pageNum are both 8, the content on Page 8 is looped through first and then the loop is terminated.

    Dimension

    Description

    Data Fetch Limit

    It restricts the number of paginated data fetches.

    • The value is 128 by default.

    • It cannot be empty. The maximum value is 10000.

    • If the limit is reached before the pagination end condition is met, the paginated data fetch will be terminated and an error will be reported.

    Pagination Method - Page Number

    Parameter:

    • As an operator-level parameter, pageNum is only valid for a single API call and has the highest priority among parameters with the same name.

    • The value of pageNum is incremented after the completion of a single API call.

    • You can use the pageNum parameter in various formats in Query Parameter and Body. Its usage is the same as that of regular parameters.


    Update Strategy:

    • Initial value: You can configure the initial value, which is 1 by default and cannot be empty.

    • Interval: You cannot modify the interval, which is 1 by default and cannot be empty.

    If the initial value and the interval are configured, the parameter value will be incremented after each loop, increasing by the value of Interval.

    Pagination End Condition:

    • httpStatus: Set the condition based on the HTTP status code returned by the API during the current loop.

    • JSONPath: Fill in the JSONPath expression based on the body in the response of this loop. (Only a single value can be returned. If an array or a JSON object is returned, it will become a string.) If the JSONPath of the response body does not exist, the value will be empty.

    • requestTimes: Set the condition based on the number of paginated requests. If the API Input operator is in a loop container, the number of paginated requests will be counted separately for each loop of that container.

    • pageNum: Set the condition based on the page number parameter $pageNum.

    iconNote:

    Referencing parameters is supported.

    Pagination Method - Offset

    Parameter:

    • As an operator-level parameter, Offset is only valid for a single API call and has the highest priority among parameters with the same name.

    • The value of Offset is incremented after the completion of a single API call.

    • You can use the Offset parameter in various formats in Query Parameter and Body. Its usage is the same as that of regular parameters.

    Update Strategy:

    • Initial value: You can configure the initial value, which is 1 by default and cannot be empty.

    • Interval: You can modify the interval, which is 20 by default and cannot be empty.

    If the initial value and the interval are configured, the parameter value will be incremented after each loop, increasing by the value of Interval.

    Pagination End Condition:

    • httpStatus: Set the condition based on the HTTP status code returned by the API during the current loop.

    • JSONPath: Fill in the JSONPath expression based on the body in the response of this loop. (Only a single value can be returned. If an array or a JSON object is returned, it will become a string). If the JSONPath does not exist in the response body, the value will be empty.

    • requestTimes: Set the condition based on the number of paginated requests. If the API Input operator is in a loop container, the number of paginated requests will be counted separately for each loop of that container.

    • offset: Set the condition based on the offset parameter $offset.

    iconNote:

    Referencing parameters is supported.

    Pagination Method - Cursor

    Cursor:

    • As an operator-level parameter, cursor is only valid for a single API call and has the highest priority among parameters with the same name.

    • It is used in scenarios where the results of the current loop are passed to the next one.

    • You can use the cursor parameter in various formats in Query Parameter and Body. Its usage is the same as that of regular parameters.

    Update Strategy:

    • Initial value: It is empty by default. You can enter a value or leave it empty. Referencing parameters is supported.

    • Update value:

    • If the JSONPath does not exist in the response body, the value will be empty.

    • Fill in the JSONPath expression based on the body in the response of this loop. (Only a single value can be returned. If an array or a JSON object is returned, it will become a string).

    iconNote:

    The cursor parameter is updated only when the pagination end condition is not met.

    Pagination End Condition:

    • httpStatus: Set the condition based on the HTTP status code returned by the API during the current loop.

    • JSONPath: Fill in the JSONPath expression based on the body in the response of this loop. (Only a single value can be returned. If an array or a JSON object is returned, it will become a string). If the JSONPath does not exist in the response body, the value will be empty.

    • requestTimes: Set the condition based on the number of paginated requests. If the API Input operator is in a loop container, the number of paginated requests will be counted separately for each loop of that container.

    • cursor: Set the condition based on the cursor parameter $cursor.

    iconNote:

    Referencing parameters is supported.

    Other functions of API data source after Paginated Data Fetch is enabled are described in the following table.

    Function

    Description

    Retry

    If a single API call during the paginated data fetch fails, the entire Data Transformation node will be retried.

    Call Frequency Control

    The frequency of API calls during the paginated data fetch in one execution instance is controlled by Call Frequency Control.

    • Two Configuration Items of Response Body Processing: JSON Path 

    • Expand Parsed JSON Data into a Two-Dimensional Table

    • If you have only enabled Paginated Data Fetch, the JSON data obtained from each fetch will be assembled into a two-dimensional table with one responseBody column and multiple rows.

    • If you have set the JSONPath expression in Response Body Processing and enabled Paginated Data Fetch, the JSON data of the corresponding path obtained each time will be assembled into a two-dimensional table with one responseBody column and multiple rows.

    The JSON data obtained each time may be different. If the corresponding JSON path cannot be found, the value will be empty.

    • If you have set the JSONPath expression to $.data in Response Body Processing and enabled Expand Parsed JSON Data into a Two-Dimensional Table and Paginated Data Fetch, the JSON data under the corresponding path obtained each time will be split into columns and assembled into a two-dimensional table with multiple columns and multiple rows.

    The JSON data obtained each time may be different. Each time the JSON data is expanded into a two-dimensional table. A column will be created for each new attribute.

    The relevant column value of data that does not have the attribute will be empty.

    Return Value Format

    If the response body is in XML format, paginated data fetch is not supported.

    Information Type (Parameter Assignment)

    • Response Body

    • Response Header

    • Status Code

    If the response body, response header, and status code are parsed by the Parameter Assignment node at the same time, the response obtained each time will be assembled into a two-dimensional table with multiple columns and multiple rows.

    附件列表


    主题: 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