Pagination
New Venue Data uses cursor-based pagination. Every list response includes a pagination object with a cursor field. Pass this cursor in your next request to get the following page.
Pagination Object
json
"pagination": {
"cursor": "cur_eyJpZCI6Im...", // pass this as ?cursor= in next request
"hasMore": true, // false on the last page
"total": 412, // total matching records
"limit": 25 // records returned this page
}Iterating Through Pages
javascript
let cursor = null
let allRecords = []
do {
const url = new URL('https://api.newvenuedata.com/v1/licenses')
url.searchParams.set('county', 'miami-dade')
url.searchParams.set('limit', '100')
if (cursor) url.searchParams.set('cursor', cursor)
const res = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.LICENSESIGNAL_API_KEY}` }
})
const json = await res.json()
allRecords = allRecords.concat(json.data)
cursor = json.pagination.cursor
} while (cursor && json.pagination.hasMore)Was this page helpful?