This endpoint is paginated to improve its performance. The example below shows
how to fetch multiple pages.
import axios from "axios";
const getPage = async (input: { limit?: number; cursor?: string }) => {
const response = await axios.get(
"https://prod.api.palomma.com/v0/payoutTargets",
{
headers: {
Authorization: "Bearer <token>",
},
params: {
...input,
},
}
);
if (!response.data) throw new Error();
const { items, cursor, count } = response.data;
return { items, cursor, count };
};
const getAll = async (input: { limit?: number }) => {
let items: any[] = [];
const firstPage = await getPage({ limit: input.limit });
if (firstPage) {
items = items.concat(firstPage.items);
let currentCursor = firstPage.cursor;
while (currentCursor !== null) {
const nextPage = await getPage({
limit: input.limit,
cursor: currentCursor,
});
items = items.concat(nextPage.items);
currentCursor = nextPage.cursor;
}
}
return items;
};
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Filter by reference provided on creation.
Number of records to return. Default is 20. Maximum is 100.
A cursor for use in pagination. The cursor indicates where to start fetching the results.
List of payout targets successfully retrieved.
The response is of type object
.