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

Create a category

Admin and inventory manager. Registers a category medicines can be filed under. The slug derives from the name when none is given, and a clash on slug or name is refused.

POST/api/v1/categories
Authorization
AuthorizationBearer token (JWT) · headerrequired

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

Request body
requiredapplication/json
namestringrequired
min length 1 · max length 80
slugstring
min length 1 · max length 80
Responses
201

Category created

slugstringrequired
namestringrequired
medicine_countintegerrequired
min -9007199254740991 · max 9007199254740991
400

The body is invalid, 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
409

A category with that slug or name already exists

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