Files
AI_Pharmacy_Api/AI_Pharmacy_Postman_Collection.json

360 lines
8.8 KiB
JSON

{
"info": {
"name": "AI Pharmacy Core API",
"description": "Complete collection for Phase 1 APIs.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"variable": [
{
"key": "base_url",
"value": "http://localhost:8080",
"type": "string"
},
{
"key": "access_token",
"value": "",
"type": "string"
}
],
"item": [
{
"name": "Health Check",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/health",
"host": [
"{{base_url}}"
],
"path": [
"health"
]
}
},
"response": []
},
{
"name": "1. Authentication",
"item": [
{
"name": "Get Access Token",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = pm.response.json();",
"if (jsonData.access_token) {",
" pm.collectionVariables.set(\"access_token\", jsonData.access_token);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"jayam_web_ai\",\n \"client_secret\": \"my_secret_key\"\n}"
},
"url": {
"raw": "{{base_url}}/v1/auth/token",
"host": [
"{{base_url}}"
],
"path": [
"v1",
"auth",
"token"
]
}
}
},
{
"name": "Register Pharmacist",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"test_pharma\",\n \"password\": \"secret123\"\n}"
},
"url": {
"raw": "{{base_url}}/v1/auth/register",
"host": [
"{{base_url}}"
],
"path": [
"v1",
"auth",
"register"
]
}
}
},
{
"name": "Pharmacist Login",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"test_pharma\",\n \"password\": \"secret123\"\n}"
},
"url": {
"raw": "{{base_url}}/v1/auth/login",
"host": [
"{{base_url}}"
],
"path": [
"v1",
"auth",
"login"
]
}
}
}
]
},
{
"name": "2. Catalogue",
"item": [
{
"name": "Search Drugs",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access_token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "X-Actor-Id",
"value": "usr_ph_1234"
}
],
"url": {
"raw": "{{base_url}}/v1/drugs/search?q=Losartan",
"host": [
"{{base_url}}"
],
"path": [
"v1",
"drugs",
"search"
],
"query": [
{
"key": "q",
"value": "Losartan"
}
]
}
}
}
]
},
{
"name": "3. Inventory",
"item": [
{
"name": "Receive Goods (GRN)",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Actor-Id",
"value": "usr_ph_admin"
},
{
"key": "idempotency-key",
"value": "idemp-{{$timestamp}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"lines\": [\n {\n \"batch_no\": \"BAT-{{$timestamp}}\",\n \"product_id\": \"prd_4410\",\n \"expiry\": \"2028-12-31\",\n \"qty\": 500,\n \"purchase_price\": \"50.00\"\n }\n ]\n}"
},
"url": {
"raw": "{{base_url}}/v1/inventory/grn",
"host": [
"{{base_url}}"
],
"path": [
"v1",
"inventory",
"grn"
]
}
}
},
{
"name": "Get Expiring Batches",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access_token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "X-Actor-Id",
"value": "usr_ph_1234"
}
],
"url": {
"raw": "{{base_url}}/v1/inventory/expiring",
"host": [
"{{base_url}}"
],
"path": [
"v1",
"inventory",
"expiring"
]
}
}
}
]
},
{
"name": "4. Dispensing",
"item": [
{
"name": "Dispense Order",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Actor-Id",
"value": "usr_ph_1234"
},
{
"key": "idempotency-key",
"value": "dispense-{{$timestamp}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"patient_id\": \"pat_101\",\n \"items\": [\n {\n \"product_id\": \"prd_4410\",\n \"qty\": 30\n }\n ]\n}"
},
"url": {
"raw": "{{base_url}}/v1/orders/dispense",
"host": [
"{{base_url}}"
],
"path": [
"v1",
"orders",
"dispense"
]
}
}
}
]
},
{
"name": "5. Audit",
"item": [
{
"name": "Get Audit Logs",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access_token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "X-Actor-Id",
"value": "usr_ph_admin"
}
],
"url": {
"raw": "{{base_url}}/v1/audit/logs?limit=10",
"host": [
"{{base_url}}"
],
"path": [
"v1",
"audit",
"logs"
],
"query": [
{
"key": "limit",
"value": "10"
}
]
}
}
}
]
}
]
}