Skip to main content

Get CPN

This API endpoint retrieves the details of a specific Customer Part Number (CPN) using its unique identifier.

HTTP Request

  • URL: /api/cpn/{id}
  • Method: GET
  • Headers:
    • accessToken: Required. This is your access token for authenticating the request.

Path Parameters

ParameterTypeDescription
idStringThe unique identifier of the CPN to retrieve.

cURL Example

Below is a sample cURL command demonstrating how to make a request to this API endpoint:

curl --location '<BASE_URL>/api/cpn/<CPN_ID>' --header 'accessToken: <ACCESS_TOKEN>'

Response

  • 200 OK: The request was successful, and the server returned the CPN details.
  • 400 Bad Request: The id parameter is missing or invalid.
  • 404 Not Found: No CPN record exists with the specified ID.
  • 5XX: Server errors indicating something went wrong on the server side.

Sample JSON Response

Below is an example of the JSON response you might receive from this endpoint:

{
"success": true,
"data": {
"_id": "69021dec6f3d8d4a6ebf8dba",
"companyId": "683808ee2b054dc60961637c",
"productId": "687a84a7958d6a5c0d0c7a35",
"cpn": "testing",
"createdBy": {
"id": "69019a38743e239a3f8f8be7",
"name": "Evangeline Schmidt",
"email": "eva@gmail.com",
"type": "store"
},
"createdAt": "2025-10-29T14:00:12.567Z",
"updatedAt": "2025-10-29T14:01:17.363Z"
}
}

Response Details

KeyTypeDescription
successBooleanIndicates whether the request was successful.
dataObjectContains the CPN details.

Customer Part Number (CPN) Data

FieldTypeDescription
_idStringThe unique identifier of the CPN.
companyIdStringThe unique identifier of the company associated with the CPN.
productIdStringThe product or variant ID associated with the CPN.
cpnStringThe Customer Part Number value.
createdByObjectInformation about the user who created the CPN.
createdAtStringDate and time when the record was created (ISO 8601 format).
updatedAtStringDate and time when the record was last updated (ISO 8601 format).

createdBy Object

FieldTypeDescription
idStringThe ID of the user who created it.
nameStringThe name of the creator.
emailStringThe email of the creator.
typeStringThe creator's user type (e.g. store).

Notes

  • Ensure the accessToken provided is valid and not expired.
  • The id path parameter must be a valid MongoDB ObjectId.
  • If no CPN exists with the provided ID, a 404 Not Found response is returned.