Skip to main content

Agency Read Campaign By Id

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

 

dev url = "https://dev.templatebackend.versal.one/api/v2"
staging url = "https://staging.template.versalence.online/api/v2"
prod url = "https://template.versalence.online/api/v2"

 

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

Header Type Description Constraints
Authorization String JWT token for user authentication and authorization. Required. Must be in the format Bearer [token].

Request Parameters

Field Type Description Constraints
id String ID of the campaign to fetch. Required.
uuid String UUID of the company or user associated with the campaign. Required.

Response Codes

Status Code Description
200 Success. Campaign data retrieved successfully.
204 No Content. No campaign found for the provided ID.
400 Bad Request. Campaign ID is required.
401 Unauthorized. Invalid or missing JWT token.
404 Not Found. No company found with the provided UUID or no campaign found with the ID.
500 Internal Server Error. An unexpected error occurred while fetching the campaign data.
403 Forbidden. 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.