Skip to content
PharmaFlow Knowledgebase
Esc
↑↓navigate↵open⌘Jpreview

Update a category

Admin and inventory manager. Renames a category and optionally moves it to a new slug. A changed slug cascades onto every medicine under it, and a slug or name clash is refused.

PUT/api/v1/categories/{slug}
Authorization
AuthorizationBearer token (JWT) · headerrequired

JWT from POST /api/v1/auth/login sent as Authorization Bearer.

Path parameters
slugstringrequired

The category slug, which is its primary key.

Request body
requiredapplication/json
namestring
min length 1 · max length 80
slugstring
min length 1 · max length 80
Responses
200

Category updated

slugstringrequired
namestringrequired
medicine_countintegerrequired
min -9007199254740991 · max 9007199254740991
400

The body is invalid, nothing is supplied to update, or the slug has no letters or digits

detailstringrequired
401

Not authenticated

detailstringrequired
403

Caller is not an admin, inventory manager, or branch manager

detailstringrequired
404

Category not found

detailstringrequired
409

A category with that slug or name already exists

detailstringrequired
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X PUT 'http://localhost:8000/api/v1/categories/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "slug": "string"
}'
Response
{
  "slug": "string",
  "name": "string",
  "medicine_count": -9007199254740991
}