Difference between revisions of "AtoZ-API"

From Book A Flight
Jump to navigation Jump to search
(Created page with "=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…")
 
Line 8: Line 8:


All calls to the system are calls to api.php, which handles presentation and uses the other two core files for the database interactions.
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 paramters
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)"},{"ID":"109597","FullName":"Panado Childrens 80 \/ (CHU)"},{"ID":"112246","FullName":"Panado Drops 60 \/ (DRP)"},{"ID":"111390","FullName":"Panado Effervescent \/ (EFT)"},{"ID":"102513","FullName":"Panado Medsip \/ (SAC)"},{"ID":"133556","FullName":"Panado Plus \/ (CAP)"}]

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

Revision as of 10:23, 28 January 2016

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 paramters 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)"},{"ID":"109597","FullName":"Panado Childrens 80 \/  (CHU)"},{"ID":"112246","FullName":"Panado Drops 60 \/  (DRP)"},{"ID":"111390","FullName":"Panado Effervescent  \/  (EFT)"},{"ID":"102513","FullName":"Panado Medsip  \/  (SAC)"},{"ID":"133556","FullName":"Panado Plus  \/  (CAP)"}]

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