AtoZ-API
Overview
This is the overview starting page for the API.JSON infrastructure for AtoZ
The core of the system comprises:
- /api-json/api.php
- /api-json/Rest.inc.php
- /api-json/dbConnect.inc.php
All calls to the system are calls to api.php, which handles presentation and uses the other two core files for the database interactions.
Methods
Public methods are accessed as calls to https://www.atozofmedicines.com/app/api.json/ METHOD_NAME ? PARAMS
All public methods other than "getToken" need to be passed an access token as one of the input parameters. During the constructor to all other API methods the token is used to
- force a login if the specified token has expired
- check for permission to access the specific API in question (Checks for a record in AtoZ_API.t_User_API with permissible ValidFrom and ValidUntil range)
- Sets $this->_EDL_Set from AtoZ_API.t_User_API.EDL_SET. This private variable is used to limit the available drugs that a client can access.
The following public methods exist in api.php
getToken
The getToken method is used to authenticate based on a username and password and the returned token is required for all other API calls
Inputs
- "sys" (the system calling this - currently unused)
- "usr" (the username to use)
- "pwd" (the password to use)
Returns
Token : xxxxxxx
Example
http://atozofmeds.local/app/api.json/getToken?sys=web&usr=TESTING&pwd=API-TEST {"token":"222628849519EF07"}
searchTrade
The searchTrade method is used to search for a medicine in the system
Inputs
- tok (a valid authentication token, with permission to access this API
- med (the name of the medicine to search for)
Returns
ID, FullName
Example
http://atozofmeds.local/app/api.json/searchTrade?tok=222628849519EF07&med=panado [{"ID":"109594","FullName":"Panado \/ (CAP)"},
{"ID":"102512","FullName":"Panado 120 mg\/5 mL (SYR)"}, {"ID":"109591","FullName":"Panado 500 \/ (TAB)"}, {"ID":"107032","FullName":"Panado Childrens 125 mg\/ (MLT)"}]
Interactions
The method is used to
Inputs
Returns
Token : xxxxxxx
Example
http://atozofmeds.local/app/api.json/ {}
Pregnancy
The method is used to
Inputs
Returns
Token : xxxxxxx
Example
http://atozofmeds.local/app/api.json/ {}
Lactation
The method is used to
Inputs
Returns
Token : xxxxxxx
Example
http://atozofmeds.local/app/api.json/ {}
Porphyria
The method is used to
Inputs
Returns
Token : xxxxxxx
Example
http://atozofmeds.local/app/api.json/ {}
PIL (under development)
The method is used to
Inputs
Returns
Token : xxxxxxx
Example
http://atozofmeds.local/app/api.json/ {}