Agency Read Campaign
API URI
https://api.versal.one/<uuid>
GET /agency/getCampaignData
Description
This API retrieves campaign data for a specified agency using a unique identifier (uuid
). It supports pagination for large datasets. A valid JWT token is mandatory for authentication and authorization.
Request Headers
Header | Type | Description | Constraints |
---|---|---|---|
Authorization |
String | JWT token for authentication and authorization. | Required. Must be in the format Bearer [token] . |
Query Parameters
Field | Type | Description | Constraints |
---|---|---|---|
uuid |
String | Unique identifier for the agency. | Required. |
page |
Integer | Page number for pagination. | Optional. Defaults to 1. |
limit |
Integer | Number of items per page. | Optional. Defaults to 10. |
Response Codes
Status Code | Description |
---|---|
200 |
Success. Campaigns retrieved successfully. |
400 |
Invalid pagination parameters or missing uuid parameter. |
403 |
Forbidden: Invalid HMAC signature. |
404 |
No campaigns found for the provided uuid or no company associated with the uuid . |
500 |
An unexpected error occurred while fetching the campaigns. |
Example Requests
Request:
GET 53d1bcd3-aaf0-45e1-9298-5395b6a27b61/agency/getCampaignData?page=1&limit=10
Authorization: Bearer 5395b6a27b61
Response (200 - Success):
{
"success": true,
"message": "Campaigns retrieved successfully.",
"data": [
// List of campaigns
],
"pagination": {
"total": 100,
"page": 1,
"limit": 10,
"totalPages": 10
}
}
Response (400 - Invalid Parameters):
{
"success": false,
"message": "Invalid pagination parameters."
}
Response (403 - Forbidden):
{
"success": false,
"message": "Forbidden: Invalid HMAC signature."
}
Response (404 - No Campaigns Found):
{
"success": false,
"message": "No campaigns found for the given UUID."
}
Response (500 - Internal Server Error):
{
"success": false,
"message": "An unexpected error occurred while fetching the campaigns.",
"error": "Error details here"
}
Notes
- Authentication: Ensure the JWT token is valid. Invalid or missing tokens will result in a 403 or 401 error.
- Field Validation: The
uuid
field is mandatory for this request. - Error Handling: Review server logs for debugging 500 errors.
- Pagination: If the
page
orlimit
is invalid, a 400 error is returned.