Agency Read Campaign By Id

API URI

https://api.versal.one/<uuid>
GET /agency/getCampaign/<campaign id>

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 53d1bcd3-aaf0-45e1-9298-5395b6a27b61/agency/getCampaign/12345
Authorization: Bearer 5395b6a27b61

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


Revision #3
Created 16 January 2025 06:05:44 by Lokesh Ravi
Updated 17 January 2025 04:29:33 by Admin