Saltar al contenido principal

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.

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)
}
})()

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

ParameterDescriptionTypeRequiredExample
start_dateThe latest date for which data should be returned. Dates should be formatted as YYYY-MM-DDstringTrue2021-01-01
end_dateThe earliest date for which data should be returned. Dates should be formatted as YYYY-MM-DDstringTrue2022-01-01
optionsAn optional object to be used with the requestobjFalse{ items_per_page: 10, page: 1 }

Options payload

ParameterDescriptionTypeMaximum
items_per_pageThe number of users to fetch. The default value is 100.int150
pageThe page to retrieve with length items_per_pageint