Skip to main content

Agency Get Customers

API URI

https://api.versal.one/<uuid>
GET /agency/getCustomers

Description

This API allows fetching customer data for a specific company identified by its uuid. It returns customer information along with pagination details, such as the next and previous pages, if applicable.


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
uuid String UUID of the company whose customer data is to be fetched. Required.

Response Codes

Status Code Description
200 Success. Customer data retrieved successfully.
403 Forbidden. Invalid HMAC signature.
400 Bad Request. Missing uuid parameter or unable to fetch customer limit data.
404 Not Found. No company found with the provided UUID.
500 Internal Server Error. An unexpected error occurred while fetching customer data.

Example Requests

Request (Get Customers):


GET 53d1bcd3-aaf0-45e1-9298-5395b6a27b61/agency/getCustomers
Authorization: Bearer 5395b6a27b61

Response (Customer Data Found - 200):


{
  "success": true,
  "message": "Customer data fetched successfully",
  "data": [
    {
      "id": "123",
      "name": "Customer A",
      "email": "customerA@example.com"
    },
    {
      "id": "124",
      "name": "Customer B",
      "email": "customerB@example.com"
    }
  ],
  "paging": {
    "before": 1,
    "after": 3
  }
}

Response (Missing UUID - 400):


{
  "success": false,
  "message": "Bad Request: Missing uuid parameter"
}

Response (No Company Found - 404):


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

Response (Unable to Fetch Customer Limit - 400):


{
  "success": false,
  "message": "Unable to fetch customer limit data"
}

Response (Invalid HMAC Signature - 403):


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

Response (Internal Server Error - 500):


{
  "success": false,
  "message": "An unexpected error occurred while fetching the customers. Please try again later.",
  "error": "Error details here"
}


Notes

  • Authentication: Ensure the JWT token is valid and authorized to access customer data.
  • Validation: The uuid is a required parameter. Ensure it's included in the request.
  • Error Handling: For any server errors (500), check the logs for detailed error information.
  • Paging: The response includes paging information to navigate through customer data.