Delete Category
This endpoint is used to delete an existing category by its ID.
Endpoint
- URL:
/categories/{id} - Method:
DELETE
Replace {id} with the specific category ID you want to delete.
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
accessToken | string | Access token for authentication. (required) |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the category to be deleted. |
Example Request
Here is an example using curl to delete a category:
curl --location --request DELETE '<BASE-URL>/categories/632ccc741683c8f033d6e163' \
--header 'accessToken: <ACCESS-TOKEN>'
Note
- Replace the placeholder in the URL with the actual category ID.
- Ensure you include a valid
accessTokenin the request to authenticate.
Response
- Status Code: 200 OK
Success Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates whether the category was deleted successfully. |
message | string | A message conveying the outcome of the operation, e.g., "Deleted". |
Example Success Response
{
"success": true,
"message": "Category deleted successfully"
}
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request: Provided data is invalid or malformed. |
| 401 | Unauthorized: Access token is invalid or missing. |
| 404 | Not Found: Category with specified ID does not exist. |
| 500 | Internal Server Error: An error occurred on the server. |
Notes
- Ensure the ID of the category you wish to delete is valid and exists.
- You must provide a valid
accessTokenfor authentication.