Add these parameters to the request path to specify which carts will be returned in the response and how they will be organized. These parameters help you efficiently navigate through cart data and focus on relevant information.
Returns a list of shopping carts with pagination and filtering options.
Parameter | Default value | Description |
---|---|---|
page |
1 |
The response to GET /api/carts/ is a page with a limited number of carts. This parameter determines the number of the page that will be sent in the response. |
items_per_page |
10 |
Determines the number of carts on a page. |
Parameter | Default value | Description |
---|---|---|
sort_by |
date |
Sort carts by customer or date . |
sort_order |
desc |
Determines the sorting order:
asc —ascending
desc —descending |
Parameter | Default value | Description |
---|---|---|
cname |
Filter carts by the name of the user. You don't have to use full names—sequences of letters from any part of the first name/last name are enough.
For example, if you use cname=do , you'll find carts that belong to John Doe, Dorian Gray, etc. |
|
email |
Show only the cart that belongs to the user with the specified email. | |
user_id |
Show only the cart that belongs to the user with the specified user ID. | |
users_type |
Show only the carts that belong to users of the specified type. Possible values:
R —registered users
G —guests |
Parameter | Default value | Description |
---|---|---|
with_info_only |
false |
Set this to true , and the response will include only the carts that belong to the users who provided contact information. |
product_type_c |
false |
Set this to true , and the response will include only those users who have something in their carts. |
product_type_w |
false |
Set this to true , and the response will include only those users who have something on their wishlist. |
total_from |
Hide the carts with the total lower than specified here. | |
total_to |
Hide the carts with the total higher than specified here. | |
p_ids |
Show carts with the specified product IDs. There are two ways to use p_ids :
1. An array: p_ids[]=1&p_ids[]=2&p_ids[]=3
2. A string: p_ids=1,2,3,4,5 |
Parameter | Default value | Description |
---|---|---|
period |
Filter carts by time period:
A —all the time
D —today
LD —previous day
W —current week
LW —last week
M —current month
LM —last month
Y —current year
LY —last year
HH —last 24 hours
HW —last 7 days
HM —last 30 days
C —specified time period (use with the time_from and time_to fields) |
|
time_from |
Hide the carts that were created before the UNIX time specified here. | |
time_to |
Hide the carts that were created after the UNIX time specified here. |
period=C
parameter, be sure to provide both time_from
and time_to
values as UNIX timestamps to define your custom date range.
https://www.venddor.com.br/api/carts/?items_per_page=20
Response is an array with 20 carts from the 1st page.
https://www.venddor.com.br/api/carts/?page=5&items_per_page=20&period=D&user_type=G
Response is an array with 20 today's guests' carts from the 5th page.
Let's examine a sample request to understand the response structure:
GET /api/carts/
If the request is successful, you'll receive HTTP/1.1 200 OK
. The response is JSON with the following structure:
{ "carts": [ { "user_id": "3810267128", "firstname": null, "lastname": null, "date": "1466409032", "ip_address": "127.0.0.1", "company_id": "1", "cart_products": "1", "total": "30.00", "order_id": null, "user_data": [] }, { "user_id": "3", "firstname": "John", "lastname": "Doe", "date": "1466409025", "ip_address": "127.0.0.1", "company_id": "1", "cart_products": "1", "total": "30.00", "order_id": null, "user_data": { "user_id": "3", "status": "A", "user_type": "C", "user_login": "customer", "email": "customer@example.com", "phone": "77 77 777 7777", "b_firstname": "John", "b_lastname": "Doe", "b_address": "44 Main street", "b_city": "Boston", "b_state": "MA", "b_country": "US", "b_zipcode": "02134" // Additional user data omitted for brevity } } ], "params": { "page": 1, "items_per_page": 10, "company_id": "1", "sort_order": "asc", "sort_by": "customer", "sort_order_rev": "desc", "total_items": "2" } }
params
object in the response includes pagination metadata, such as the current page, items per page, and total number of items available. This information is useful for implementing pagination controls in your application.