Pagination
Pagination Parameters
Many endpoints support pagination:
page- Page number (default: 1)limit- Results per page (default: 50, max: 100)
Example Request
curl -X POST 'https://ws.spac.io/api/v1/getProperties' \
-H 'apikey: your-api-key' \
-d 'agent_key=agent_123&page=2&limit=50'
Pagination Response
{
"success": true,
"data": [...],
"pagination": {
"current_page": 2,
"total_pages": 5,
"total_results": 234
}
}
Iterating Through All Results
def get_all_properties(agent_key, api_key):
all_properties = []
page = 1
while True:
response = requests.post(
'https://ws.spac.io/api/v1/getProperties',
headers={'apikey': api_key},
data={'agent_key': agent_key, 'page': page, 'limit': 100}
).json()
all_properties.extend(response['data'])
if page >= response['pagination']['total_pages']:
break
page += 1
return all_properties