Skip to main content

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

HeaderTypeDescription
accessTokenstringAccess token for authentication. (required)

Path Parameters

ParameterTypeDescription
idstringThe 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 accessToken in the request to authenticate.

Response

  • Status Code: 200 OK

Success Response Fields

FieldTypeDescription
successbooleanIndicates whether the category was deleted successfully.
messagestringA message conveying the outcome of the operation, e.g., "Deleted".

Example Success Response

{
"success": true,
"message": "Category deleted successfully"
}

Error Responses

Status CodeDescription
400Bad Request: Provided data is invalid or malformed.
401Unauthorized: Access token is invalid or missing.
404Not Found: Category with specified ID does not exist.
500Internal 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 accessToken for authentication.