# RelianceHMO Telemedicine Prescription APIs
## Overview:
Public APIs for Prescription-driven integration with third party pharmacy providers.
**Base URL**: https://api.staging.reliancehmo.com/v1/public
**Authentication**: HTTP BASIC using API key as username, secret as password. (key and secret to be shared)
**Request/Response**: JSON
Content:
* [POST /prescriptions/validate](#POST-prescriptionsvalidate)
* [POST /prescriptions/{id}/results](#POST-prescriptionsidresults)
* [GET /prescriptions/{id}/drugs](#GET-prescriptionsiddrugs)
* [PUT /prescriptions/{id}](#PUT-prescriptionsid)
* [PUT /prescriptions/{id}/provider](#PUT-prescriptionsidprovider)
* [GET /prescriptions](#GET-prescriptionspage1amplimit10)
---
## APIS
#### **`POST` /prescriptions/validate**
> Validate a Prescription Code. This will respond with the tests needed to be carried out, if any. For prescriptions that have already been dispensed, the status within the data object will be `dispensed`.
>
Params:
```
{
"code": "PRC/12355"
}
```
Response:`SUCCESS`
```
{
"status":"success | error",
"message":"",
"data":{
"id":23,
"enrollee":{
"first_name":"John",
"last_name":"Doe",
"hmo_id":"RET/10012/A"
},
"dispatch_status": "pending | dispensed | cancelled"
"tests":[
{
"id": 12,
"name": "Test 1"
}
]
}
}
```
Response:`ERROR`
```
{
"status":"error",
"message":"Invalid Code"
"data":{}
}
```
---
#### **`POST` /prescriptions/{id}/results**
> Submit test results. Please note the drugs array in the response will only be available for test results that are positive.
>
Params:
```
{
"result": "positive | negative",
"comment":"A Comment",
"file_id":34 //optional
"test_id":5
}
```
Response:
```
{
"message":"Test result submitted successfully!"
}
```
---
#### **`GET` /prescriptions/{id}/drugs**
> Get Prescription Drugs. Please NOTE: These drugs will only be available after the test results have been uploaded and the result is positive, or if no tests are required.
>
Response:
```
{
"message":"Drugs retrieved successfully!"
"data":[
{
"id": 12,
"name": "Drug 1",
"dosage": "100mg tablets 3 times daily"
},
{
"id": 12,
"name": "Drug 1",
"dosage": "250mg Tablets, Once a Day"
}
]
}
```
#### **`PUT` /prescriptions/{id}**
> To update the status of a prescription, to indicate whether or not it was dispensed, or if some drugs in particular were not dispensed.
>
Params:
```
{
"was_dispensed": true | false,
"exceptions": [4,19,22] // Optional array of drug ids, that were not dispensed.
}
```
Response:
```
{
"message":"Status updated successfully."
}
```
---
#### **`PUT` /prescriptions/{id}/provider**
> To set a pick pharmacy for a prescription. You can send one at a time or both.
>
Params:
```
{
"provider": {
"pharmacy_code":"",
"name": "A Pharmacy",
"address": "Somewhere in Lagos"
}
}
```
Response:
```
{
"message":"Provider(s) updated successfully."
}
```
---
#### **`GET` /prescriptions?page=1&limit=10**
> Get all prescriptions received over time.
>
Response:
```
{
"data":[
{
"id":23,
"enrollee":{
"first_name":"John",
"last_name":"Doe",
"hmo_id":"RET/10012/A"
},
"tests":[
{
"id":4,
"name":"Test 1"
}
],
"drugs":[
{
"id": 12,
"name": "Drug 1",
"dosage": "20mg, 2 times daily"
}
],
"created_at":"",
"dispense_status":"pending | dispensed | cancelled",
"price":"1000.00"
}
],
"pagination":{
"current_page": 1,
"last_page": 2,
"per_page": 10,
"total": 3,
"count": 1
}
}
```
---
#### **`POST` https://api.staging.reliancehmo.com/v1/public/upload**
> File Upload. To Upload an image of the test result. The filename returned here should be passed to the [test result endpoint](#POST-prescriptionsidresults).
>
**Content-Type**: `application/form-data`
Params:
```
{
"file_use": "test_result",
"file": file.[png | jpg | jpeg | gif]
}
```
Response:
```
{
"status": "success",
"data": {
"file_id": "123"
"filename": "60e093cd7d33c821762e.png"
}
```
---