List Card Products
Learn how to retrieve card products’ information.
We'll cover the following
Overview
In this lesson, we’ll learn how to get a list of all existing card products. We’ll also learn how to get information about a specific card product we choose.
Endpoints
Get all card products
We can get a list of all card products by making a GET
request to the {BASE_URL}/cardproducts
endpoint. This gives us a list of all existing card products with their details. This endpoint also supports pagination, which allows us to retrieve a specific range of resources from the sorted list of returned resources.
Get a single card product
Similarly, we can get a single card product by making a GET
request to the {BASE_URL}/cardproducts/{token}
endpoint. The path parameter ({token}
) refers to the token of the card product that we want to retrieve.
Request parameters
Parameter | Type | Category | Description |
| string | required | Token of the card product we want to retrieve Note: This is a path parameter to get a single card product. |
| integer | optional | Number of card products to retrieve Allowable values: 1–10 Note: This is a query parameter to get all card products. |
| string | optional | Sorts by the given value Note: By default, the sorting is in ascending order. To sort in descending order, add a hyphen (-) to the field name. This is a query parameter to get all card products. |
| integer | optional | Sort order index of the first object in the array of returned resources Note: This is a query parameter to get all card products. |
Sample codes
Note: You may append any of the optional query parameters in the table above to the
url
in line 1 to fine-tune your search.
Click the “Run” button in the code widget below to see the list of all card products.
url = '{{BASE_URL}}cardproducts'response = requests.get(url, headers=headers)printResponse(response)
Line 1: We have the value for {token}
, which is a required path parameter, that we stored in the previous lesson. However, we may also use any token
value from the output of the code above.
Click the “Run” button in the code widget below to see the output.
token = '{{CARD_PRODUCT_TOKEN}}'url = '{{BASE_URL}}cardproducts/' + tokenresponse = requests.get(url, headers=headers)printResponse(response)
Output
When the code is successfully executed, the output displays the requested number of card product objects (with their attributes), their total count and other information.
Note: We may see an extra card product with the name
Reloadable Card
as part of the output of the first block of code.
For the second code widget, the output displays the complete card product object that corresponds to the given token
with all of the requested data fields.
In case of failure, an appropriate error message is displayed.