Query Capabilities

Introduction to Querying Functions

Our API's querying functions allow users to efficiently retrieve transaction data with options for sorting, paging, and filtering. These features enable precise data management and retrieval, tailored to specific needs.

Sorting

Sorting allows you to arrange the results based on one or more fields in ascending or descending order.

{  
  "sort": "fieldName,-anotherField"  
}
  • fieldName sorts the results in ascending order by fieldName.
  • anotherField sorts the results in descending order by anotherField.

Paging

Paging enables you to limit the number of results returned and to skip a certain number of results, which is useful for pagination.

{  
  "limit": 10,  
  "offset": 20  
}
  • limit specifies the maximum number of results to return.
  • offset specifies the number of results to skip before starting to return results.

Filtering

Filtering allows you to query specific records based on criteria.

{  
    "status": "succeeded",  
    "amount": { "$gte": 100 }  
}

The filter selects transactions where status is succeeded and amount is greater than or equal to 100.

Applying to the Endpoint

To apply sorting, paging, and filtering to the given endpoint, you can include these options in the JSON data sent with the request. Below is an example combining sorting, paging, and filtering:

curl --location '<https://sandbox-platform.jupico.com/v1/query/transactions'>  
--header 'Content-Type: application/json'  
--header 'Authorization: Basic ZGVtb0FwaVVzZXI6ZGVtbzIwMTk='  
--data '{  
  "sort": "-createdAt",  
  "limit": 10,  
  "offset": 0,  
  "status": "succeeded",  
  "amount": { "$gte": 100 }  
}'
  • Sorting: The results are sorted by createdAt in descending order (createdAt).
  • Paging: The request limits the results to 10 transactions (limit: 10) and skips 0 results (offset: 0).
  • Filtering: The filter includes transactions with status equal to succeeded and amount greater than or equal to 100.