Delete CPN
This DELETE API allows you to remove an existing Customer Part Number (CPN) record from the system using its unique identifier.
Endpoint Details
- URL:
/api/cpn/{id} - Method:
DELETE - Authentication: Bearer Token (required)
Authentication
You must provide a valid accessToken in the request headers to authenticate and access this endpoint.
Authentication Headers
| Header | Type | Description |
|---|---|---|
Content-Type | string | Must be set to application/json. |
accessToken | string | A valid access token is required. |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the CPN to be deleted. |
cURL Example
curl --location --request DELETE '<BASE_URL>/api/cpn/<CPN_ID>' --header 'accessToken: <ACCESS_TOKEN>'
Response
Success Response
| Status Code | Description |
|---|---|
| 200 OK | The CPN was deleted successfully. |
Sample Success Response Body
{
"success": true,
"message": "Deleted successfully"
}
Error Responses
| Status Code | Description |
|---|---|
| 400 Bad Request | Missing id parameter or company is locked. |
| 401 Unauthorized | Invalid or missing access token. |
| 403 Forbidden | Access denied. |
| 404 Not Found | The specified CPN record does not exist. |
| 500 Internal Server Error | An unexpected server error occurred. |
Notes
- The
idmust be a valid MongoDB ObjectId. - If the associated company is locked, deletion will be blocked.
- Ensure your access token has permission to delete CPNs.
- Upon successful deletion, the CPN will also be removed from the Elasticsearch index.