Skip to content

Commit 92969c3

Browse files
committed
Add filters usage documentation
1 parent 0d660c9 commit 92969c3

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ Check out all the resources and Python code examples in the official [Mailjet Do
3232
- [Using actions](#using-actions)
3333
- [GET request](#get-request)
3434
- [Retrieve all objects](#retrieve-all-objects)
35-
- [Use filtering](#use-filtering)
35+
- [Using filtering](#using-filtering)
36+
- [Using pagination](#using-pagination)
3637
- [Retrieve a single object](#retrieve-a-single-object)
3738
- [PUT request](#put-request)
3839
- [DELETE request](#delete-request)
@@ -236,6 +237,30 @@ print result.status_code
236237
print result.json()
237238
```
238239

240+
#### Using pagination
241+
242+
Pagination can be used when API returns Data as array type.
243+
There is 2 options: `limit` and `offset`.
244+
You can find such request example [here](https://dev.mailjet.com/email/reference/contacts/contact/#v3_get_contact).
245+
Next example returns 40 contacts starting from 50 record:
246+
247+
```python
248+
import os
249+
from mailjet_rest import Client
250+
251+
api_key = os.environ["MJ_APIKEY_PUBLIC"]
252+
api_secret = os.environ["MJ_APIKEY_PRIVATE"]
253+
mailjet = Client(auth=(api_key, api_secret))
254+
255+
filters = {
256+
"limit": 40,
257+
"offset": 50,
258+
}
259+
result = mailjet.contact.get(filters=filters)
260+
print(result.status_code)
261+
print(result.json())
262+
```
263+
239264
#### Retrieve a single object
240265

241266
```python

0 commit comments

Comments
 (0)