-
Notifications
You must be signed in to change notification settings - Fork 8
HTTP API Documentation
This document details the parameters and endpoints of the FMKe HTTP (REST) API.
FMKe has a total of 5 entities: patient
, facility
, pharmacy
, staff
, prescription
.
When FMKe boots, it starts a local HTTP server that will bind to the port defined in the HTTP_PORT
environment variable, defaulting to the one in the local fmke.config
file or 9090 if the file is not present.
Experimenting with the HTTP API is a good way to understand how load is generated over the application server, as the fmke_client executes multiple requests in a loop over this HTTP interface. To get a feel for how the interface works, you can run rebar3 shell
after configuring fmke.config
to use ETS, Erlang's built-in key-value store. Then, you can use a tool like Postman in order to make requests that follow the specification in this document.
Important note: The casing (upper/lower case) for each of the parameters here listed matters.
The HTTP endpoints that will be available are:
A patient with id 7
can be fetched by sending a GET request to /patients/7
.
It's possible to create a patient by sending a POST request to /patients
with the following parameters:
Parameter | Type |
---|---|
id | integer |
name | string |
address | string |
You can update an existing patient by sending a PUT request to /patients/:patient_id
, where :patient_id
is an ID of an already existent patient. You need to supply the following parameters:
Parameter | Type |
---|---|
name | string |
address | string |
A facility with id 7
can be fetched by sending a GET request to /facilities/7
.
It's possible to create a facility by sending a POST request to /facilities
with the following parameters:
Parameter | Type |
---|---|
id | integer |
name | string |
address | string |
type | string |
You can update an existing facility by sending a PUT request to /facilities/:facility_id
, where :facility_id
is an ID of an already existent facility. You need to supply the following parameters:
Parameter | Type |
---|---|
name | string |
address | string |
type | string |
A pharmacy with id 7
can be fetched by sending a GET request to /pharmacies/7
.
It's possible to create a pharmacy by sending a POST request to /pharmacies
with the following parameters:
Parameter | Type |
---|---|
id | integer |
name | string |
address | string |
You can update an existing pharmacy by sending a PUT request to /pharmacies/:pharmacy_id
, where :pharmacy_id
is an ID of an already existent pharmacy. You need to supply the following parameters:
Parameter | Type |
---|---|
name | string |
address | string |
A staff member with id 7
can be fetched by sending a GET request to /staff/7
.
It's possible to create a staff member by sending a POST request to /staff
with the following parameters:
Parameter | Type |
---|---|
id | integer |
name | string |
address | string |
speciality | string |
You can update an existing staff member by sending a PUT request to /staff/:staff_id
, where :staff_id
is an ID of an already existent staff member. You need to supply the following parameters:
Parameter | Type |
---|---|
name | string |
address | string |
speciality | string |
A prescription with id 7
can be fetched by sending a GET request to /prescriptions/7
.
It's possible to create a prescription by sending a POST request to /prescriptions
with the following parameters:
Parameter | Type |
---|---|
id | integer |
patient_id | integer |
prescriber_id | integer |
pharmacy_id | integer |
facility_id | integer |
date_prescribed | string |
drugs | string |
Important note: drugs
is a String made up of comma separated values (CSV) for each drug in the prescription.
You can update an existing staff member by sending a PUT request to /prescriptions/:prescription_id
, where :prescription_id
is an ID of an already existent prescription. You need to supply the following parameters:
Parameter | Type |
---|---|
date_processed | string |
drugs | string |
Important note: drugs
is a String made up of comma separated values (CSV) for each drug in the prescription.
Despite both parameters having to be present in order for it to be considered a valid PUT request, the system will behave in the following way:
- If
date_processed
is set to a value, it will assume that you're trying to process the prescription. - If
date_processed
is empty anddrugs
is not, it will add all CSV to as new drugs of the prescription.
- Benchmarking
- Implementing Drivers
- Testing
- Documentation