Pagination

In this guide, we will look at how to work with paginated responses when querying the FAVOR API. By default, all responses limit results to 15. However, you can go as high as 100 by adding a limit parameter to your requests.

When an API response returns a list of objects, no matter the amount, pagination is supported. In paginated responses, objects are nested in a data attribute and have a has_more and count attribute that indicates whether you have reached the end of the last page.

Example using cURL

In this example, we will request the page 1 of the /v1/genes/APOE/snv endpoint. The response will contain data, has_more and count attributes.

Attributes

  • Name
    data
    Type
    list
    Description

    The list of objects returned by the query.

  • Name
    has_more
    Type
    bool
    Description

    Indicates whether there are more pages to browse.

  • Name
    count
    Type
    integer
    Description

    The total number of objects that match the query.

Query parameters

  • Name
    page
    Type
    integer
    Description

    The page number to browse.

  • Name
    limit
    Type
    integer
    Description

    The number of objects to return per page.

Manual pagination using cURL

curl -G https://api.genohub.org/v1/genes/APOE/snv \
-d page=1 \
-d limit=15

Paginated response

{
    "count": 1384,
    "has_more": true,
    "data": [
    {
        "variant_vcf": "19-44909369-A-C",
        "chromosome": "19",
        "position": "44909369",
        "genecode_comprehensive_info": "APOE(ENST00000252486.9:c.*119A\u003eC)",
        "bravo_an": "264690",
        "bravo_ac": "1",
        "bravo_af": "0.000003778",
        "filter_status": "PASS",
        "genecode_comprehensive_category": "UTR3",
        // ...
    },
    {
    "variant_vcf": "19-44909361-C-G",
    "chromosome": "19",
    "position": "44909361",
    "genecode_comprehensive_info": "APOE(ENST00000252486.9:c.*111C\u003eG)",
    "bravo_an": "264690",
    "bravo_ac": "26",
    "bravo_af": "0.0000982281",
    "filter_status": "PASS",
    "genecode_comprehensive_category": "UTR3",
    // ...
    },
    {
    "variant_vcf": "19-44909360-C-T",
    "chromosome": "19",
    "position": "44909360",
    "genecode_comprehensive_info": "APOE(ENST00000252486.9:c.*110C\u003eT)",
    "bravo_an": "264690",
    "bravo_ac": "1",
    "bravo_af": "0.000003778",
    "filter_status": "PASS",
    "genecode_comprehensive_category": "UTR3",
    // ...
    },
    // ...
]}