The Pharst Care Business API allows you to make request to Pharst Care for medications to be delivered to your clients directly through your own application. The API is designed according to REST (Representational State Transfer) principles. The API uses JavaScript Object Notation (JSON) for requests and responses, and also allows batch processing. All API traffic is encrypted over HTTPS.
Base URL | Description |
---|---|
https://www.pharst.care/api/health/ | Use this as the base path for all the API endpoints avaialble on Pharst Care Business APIs |
We expect that all requests are authenticated. The authentication parameters should be included in the request headers as follows:
Key |
Value |
---|---|
|
|
To obtain your keys, you will need to first register your business on Pharst Care using this https://www.pharst.care/business/add-my-business/
You can request for Pharst Care to supply you with medicine names, these names are updated periodically. You will get access to all the names in one API request, this is so that you could maybe store the names on your own end and use it later.
Name | Value |
---|---|
Endpoint | drugs/get-drugs/ |
Method | GET |
Authorization | Yes |
Here is an example GET
request to get all drug names using the axios JavaScript request library to the drugs/get-drugs/ endpoint:
axios.get('drugs/get-drugs/',headers={
Authorization:"Bearer <PUBLIC API KEY>"}) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); });
Below is a sample of the response after the request goes through successfully, if your response is different, refer to the Status codes.
{ success:true, code:200, data:[ "Aboniki", . . .,
Zytiga
] }
Here is a sample response for a failed request:
{
success:false,
message:"some message",
code:some_code
}
In both cases, a JSON Object is returned.
It is also possible to directly search for a medication using our APIs. The advantage to this is that you get some more information apart from just the name of a medicine.
This API does not expect the name of the medication you are searching for to be typed correctly/completely, anything close enough will still fetch you what you are looking for, provided it is available in our database.
You can also tweak how close you want the search query to be with the real names using what we call the match_ratio, it falls between 0 - 1, we default it to 0.7. The lower the match_ratio, the more arbitrary the results.
Name | Value |
---|---|
Endpoint | drugs/search-drugs/ |
Method | GET |
Authorization | Yes |
Parameter | Type / Example | Required | Default |
---|---|---|---|
q | string / "Para" | Yes | Must be provided |
match_ratio | double / 0.7 | No | 0.7 |
per_page | int / 5 | No | 10 |
page | int / 1 | No | 1 |
Here is an example GET
request to get all drug names using the axios JavaScript request library to the drugs/search-drugs/ endpoint:
axios.get('drugs/search-drugs?q=inha&match_ratio=0.5',headers={
Authorization:"Bearer <PUBLIC API KEY>"}) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); });
Below is a sample of the response after the request goes through successfully, if your response is different, refer to the Status codes.
{ "links": { "next": null, "previous": null }, "total_count": 3, "total_pages": 1, "count": 3, "data": [ { "nickname": "Mak 2 Inhaler", "technical_name": "Mak 2 Inhaler", "updated": "22 Aug, 2022", "divisions": [ { "id": 2529, "division": "unit", "price": 7.5, "form": "Syrup", "strength": null, "unit": null, "quantity": 1.0, "updated": "22 Aug,2022 at 07:28pm" } ] }, { "nickname": "Olbas Oil Inhalant Decongestant Lanes", "technical_name": "", "updated": "22 Aug, 2022", "divisions": [ { "id": 1589, "division": "box", "price": 100.0, "strength": null, "unit": null, "quantity": 10.0, "updated": "22 Aug,2022 at 07:28pm" }, { "id": 2158, "division": "strip", "price": 5.0, "strength": null, "unit": null, "quantity": 10.0, "updated": "22 Aug,2022 at 07:28pm" } ] }, { "nickname": "Ventolin Inhaler", "technical_name": "Inhaler", "updated": "22 Aug, 2022", "divisions": [ { "id": 2314, "division": "strip", "price": 40.0, "form": "Inhaler", "strength": null, "unit": null, "quantity": 1.0, "updated": "22 Aug,2022 at 07:28pm" } ] } ] }
Here is a sample response for a failed request:
{
success:false,
message:"some message",
code:some_code
}
In both cases, a JSON Object is returned.