Get Sales Rep
This GET endpoint retrieves detailed information about a specific sales representative using their unique ID.
Endpoint
- URL:
/api/salesRep/:id - Method:
GET
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the sales rep to retrieve. |
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
accessToken | string | Access token for authentication. (required) |
Request Body
No request body is required for this GET operation.
Response
- Status Code: 200 OK
Sample Response Body
A successful response will return detailed information about the sales representative:
{
"success": true,
"data": {
"id": "66a5023524b16685e42a1eda",
"email": "salesrep@example.com",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": "+1234567890",
"company": "665434c100e82884676936b9",
"status": "active",
"salesRepCompanies": [
"665434c100e82884676936b9",
"665434c100e82884676936ba"
],
"metaFields": [],
"createdAt": "2024-07-27T14:20:37.573Z",
"updatedAt": "2024-08-03T10:29:32.489Z"
}
}
Success Response
Main Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the request was successful. |
data | object | Contains the details of the sales rep. |
Sales Rep Object (data)
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the sales rep. |
email | string | Email address of the sales rep. |
firstName | string | First name of the sales rep. |
lastName | string | Last name of the sales rep. |
phoneNumber | string | Contact number of the sales rep. |
company | string | Primary company ID associated with the sales rep. |
status | string | Current status of the sales rep (e.g., "active"). |
salesRepCompanies | array | Array of company IDs assigned to the sales rep. |
metaFields | array | Additional metadata related to the sales rep. |
createdAt | string (ISO 8601) | Timestamp of when the sales rep was created. |
updatedAt | string (ISO 8601) | Timestamp of the last update to the sales rep data. |
Error Responses
| Status Code | Description |
|---|---|
| 400 Bad Request | Invalid request format or id parameter. |
| 401 Unauthorized | The access token is invalid or missing. |
| 403 Forbidden | You do not have permission to access this resource. |
| 404 Not Found | No sales rep matches the specified id. |
| 500 Internal Server Error | An error occurred on the server. |
Sample Error Response
{
"success": false,
"message": "Error message describing what went wrong"
}
Notes
- Ensure the
idin the URL is replaced with the actual ID of the sales rep you wish to view. - Confirm your access token is valid and has the necessary permissions (READ_WRITE_CUSTOMER scope) to access sales rep data.
- This endpoint returns detailed sales rep information for authorized users.
- Sensitive fields like
passwordare automatically excluded from the response.
Examples
Example Request
GET /api/salesRep/66a5023524b16685e42a1eda
Example Response
{
"success": true,
"data": {
"id": "66a5023524b16685e42a1eda",
"email": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": "+1234567890",
"company": "665434c100e82884676936b9",
"status": "active",
"salesRepCompanies": [
"665434c100e82884676936b9",
"665434c100e82884676936ba",
"665434c100e82884676936bb"
],
"metaFields": [
{
"key": "territory",
"value": "Northeast"
}
],
"createdAt": "2024-07-27T14:20:37.573Z",
"updatedAt": "2024-08-03T10:29:32.489Z"
}
}