List Users - POST
To get the Users
that logged in with your connect, you need to make a POST
request to the endpoint
POST https://api.palenca.com/v1/users/search
Users are returned in reverse chronological order.
Results are paginated due to the possible large number of users you could manage, manipulate the items_per_page
and page
parameters in conjunction with the total_items
response body field to fetch all available users.
- JavaScript
- Python
- curl
const axios = require('axios')
const data = JSON.stringify({
"start_date": "2022-12-31",
"end_date": "2022-01-01",
"options": {
"items_per_page": 50,
"page": 1
}
});
const config = {
method: 'post',
url: 'https://api.palenca.com/v1/users/search',
headers: {
'x-api-key': 'private_api_key',
'Content-Type': 'application/json'
},
data: data
};
(async () => {
try {
const {data} = await axios(config)
console.info(JSON.stringify(response.data))
} catch (error) {
console.error(error)
}
})()
import requests
url = 'https://api.palenca.com/v1/users/search'
payload = {
"start_date": "2022-12-31",
"end_date": "2022-01-01",
"options": {
"items_per_page": 50,
"page": 1
}
}
headers = {
'x-api-key': 'private_api_key',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
curl --location --request POST 'https://api.palenca.com/v1/users/search'
--header 'x-api-key: private_api_key' \
--header 'Content-Type: application/json' \
--data-raw '{
"start_date": "2022-12-31",
"end_date": "2022-01-01",
"options": {
"items_per_page": 50,
"page": 1
}
}'
Returns a JSON structured like this:
{
"success": true,
"error": null,
"data": {
"users": [
{
"user_id": "9334389a-c93c-4183-9894-ea8eb72f82e8",
"external_id": "e69bdbc2-495c-4356-be5f-13c55644a80b",
"widget_id": "feecb679-a3cc-47ef-8fd4-600799f12a39"
},
{
"user_id": "91d2e527-f24f-4910-94b6-e575de7e98e4",
"external_id": "e9445f5e-746e-4331-a2d7-fa6e678b37e6",
"widget_id": "feecb679-a3cc-47ef-8fd4-600799f12a39"
},
{
"user_id": "942f6b16-7d72-4dc8-8c51-242af8298f2b",
"external_id": "ab3b23c6-f3bf-4ae9-9799-ee75e7067c82",
"widget_id": "feecb679-a3cc-47ef-8fd4-600799f12a39"
}
]
},
"pagination": {
"page": 1,
"items_per_page": 50,
"total_items": 200,
"total_pages": 4
}
}
Payload
Parameter | Description | Type | Required | Example |
---|---|---|---|---|
start_date | The latest date for which data should be returned. Dates should be formatted as YYYY-MM-DD | string | True | 2021-01-01 |
end_date | The earliest date for which data should be returned. Dates should be formatted as YYYY-MM-DD | string | True | 2022-01-01 |
options | An optional object to be used with the request | obj | False | { items_per_page: 10, page: 1 } |
Options payload
Parameter | Description | Type | Maximum |
---|---|---|---|
items_per_page | The number of users to fetch. The default value is 100. | int | 150 |
page | The page to retrieve with length items_per_page | int |