Skip to main content

Agency Read Campaign By Id

GET /agency/getCampaign/:id?uuid={uuid}

Description

This API allows fetching campaign details by providing the campaign id and the uuid of the company. The endpoint returns campaign data if found, otherwise, a message indicating no data found.


Request Headers

HeaderTypeDescriptionConstraints
AuthorizationStringJWT token for user authentication and authorization.Required. Must be in the format Bearer [token].

Request Parameters

FieldTypeDescriptionConstraints
idStringID of the campaign to fetch.Required.
uuidStringUUID of the company or user associated with the campaign.Required.

Response Codes

Status CodeDescription
200Success. Campaign data retrieved successfully.
204No Content. No campaign found for the provided ID.
400Bad Request. Campaign ID is required.
401Unauthorized. Invalid or missing JWT token.
404Not Found. No company found with the provided UUID or no campaign found with the ID.
500Internal Server Error. An unexpected error occurred while fetching the campaign data.
403Forbidden. Invalid HMAC signature.

Example Requests

Request (Get Campaign):


GET /agency/getCampaign/12345?uuid=53d1bcd3-aaf0-45e1-9298-5395b6a27b61
Authorization: Bearer your-jwt-token

Response (Campaign Found - 200):


{
  "success": true,
  "message": "Successfully fetched campaign data.",
  "data": [
    {
      "id": "12345",
      "uuid": "53d1bcd3-aaf0-45e1-9298-5395b6a27b61",
      "name": "Campaign Name",
      "status": "active",
      "startDate": "2025-01-01",
      "endDate": "2025-12-31"
    }
  ]
}

Response (No Campaign Found - 204):


{
  "success": true,
  "message": "No campaign data found.",
  "data": []
}

Response (Missing Campaign ID - 400):


{
  "success": false,
  "message": "Campaign ID is required."
}

Response (No Company Found - 404):


{
  "success": false,
  "message": "No company found with the provided uuid"
}

Response (Internal Server Error - 500):


{
  "success": false,
  "message": "An unexpected error occurred while fetching the campaign by id. Please try again later."
}

Response (Invalid HMAC Signature - 403):


{
  "success": false,
  "message": "Forbidden: Invalid HMAC signature"
}


Notes

  • Authentication: Ensure the JWT token is valid and authorized to access campaign data.
  • Validation: Both id and uuid are required. Missing any of these will result in a 400 or 404 error.
  • Error Handling: For any server errors (500), check the logs for detailed error information.