AtoZ-API

From Book A Flight
Jump to navigation Jump to search

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.

This API does NOT honour the $this->_EDL_Set in returning results!

Inputs

  • tok (a valid authentication token, with permission to access this API
  • med (the name of the medicine to search for - code uses %med% wildcards in search)

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 search for interaction details for the medicines in the input list.

Inputs

Returns

Token : xxxxxxx

Example

http://www.atozofmedicines.com/app/api.json/Interactions?tok=58807DD58D548695&lst=%7C110332%7C103851%7C108395%7C118351%7C102858&limit=N
{"DATA":[{"TradeA":"108395","MedicineA":"Cipla Warfarin","TradeB":"110332","MedicineB":"Zocor","severity":"unsafe.png",
   "Details":{
     "Detail1":{"Category":"Warning","Description":"Caution advised.","ReferenceID":"24675"},
     "Detail2":{"Category":"Advice","Description":"Individual response.","ReferenceID":"14706"},
     "Detail3":{"Category":"Advice","Description":"Substitute statin: atorvastatin, pravastatin.","ReferenceID":"24680"}
   }
 },
 {"TradeA":"102858","MedicineA":"Sandoz Omeprazole","TradeB":"108395","MedicineB":"Cipla Warfarin","severity":"unsafe.png",
   "Details":{
     "Detail1":{"Category":"Warning","Description":"Caution advised.","ReferenceID":"20168"},
     "Detail2":{"Category":"Monitor","Description":"INR\/PT levels closely if initiating, discontinuing or changing the dose of either drug.","ReferenceID":"20169"}
    }
 }],
 "MESSAGE":{"NoData":[["103851"],["118351"]]}}

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/
{}