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

Attach an uploaded photo to a medicine

Admin, inventory manager, or branch manager. Points a medicine at an already stored photo. The key must sit under the medicines prefix at 5 MB or less, and the medicine must exist.

POST/api/v1/images/medicines/{medicineId}/image
Authorization
AuthorizationBearer token (JWT) · headerrequired

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

Path parameters
medicineIdstringrequired

The medicine whose photo changes.

Request body
requiredapplication/json
image_keystringrequired
min length 1
Responses
200

The medicine with its new photo

idstringrequired
namestringrequired
generic_namestringrequired
barcodestringrequired
categorystringrequired
formstringrequired
strengthstringrequired
unitstringrequired
selling_pricestringrequired
max_public_pricestringrequired
stock_quantityintegerrequired
min -9007199254740991 · max 9007199254740991
low_stock_thresholdintegerrequired
min -9007199254740991 · max 9007199254740991
requires_prescriptionbooleanrequired
is_controlledbooleanrequired
vat_categorystringrequired
requires_cold_chainbooleanrequired
sfda_registration_nostringrequired
image_keystringrequired
image_urlstringrequired
is_activebooleanrequired
created_atstringrequired
updated_atstringrequired
400

The image key is not under the medicines prefix, or the upload is missing or larger than 5 MB

detailstringrequired
401

Not authenticated

detailstringrequired
403

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

detailstringrequired
404

Medicine not found

detailstringrequired
500

Image storage is unavailable

detailstringrequired
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST 'http://localhost:8000/api/v1/images/medicines/string/image' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "image_key": "string"
}'
Response
{
  "id": "string",
  "name": "string",
  "generic_name": "string",
  "barcode": "string",
  "category": "string",
  "form": "string",
  "strength": "string",
  "unit": "string",
  "selling_price": "string",
  "max_public_price": "string",
  "stock_quantity": -9007199254740991,
  "low_stock_threshold": -9007199254740991,
  "requires_prescription": true,
  "is_controlled": true,
  "vat_category": "string",
  "requires_cold_chain": true,
  "sfda_registration_no": "string",
  "image_key": "string",
  "image_url": "string",
  "is_active": true,
  "created_at": "string",
  "updated_at": "string"
}