Difference between revisions of "API Documentation"

From TMS Support Wiki
Jump to navigation Jump to search
Line 1: Line 1:
This documentation explains the various methods that can be called on the Application Programming Interface (API) that is exposed by the Prescription Tracking Application (PTS5).  
PTS 5 now includes a self-documenting application programming interface (API).


The PTS5 API is an HTTP REST API. Examples using JSON format will be provided throughout the documentation.
The PTS 5 API is an HTTP REST API and implements the open source Swagger UI API self-documenting tool. The documentation can be accessed by simply appending /swagger to the end of your PTS URL, e.g.: <strong><nowiki>http://YourPTSServer/PTSWeb/swagger</nowiki></strong>
=Accessing the API=
The API can be accessed at the following endpoints:


{| class="wikitable"
The Swagger implementation for our live PTS 5 demo, which is constantly updated to the latest version, can be found here: http://prescriptiontracking.co.uk/swagger
|-
|<strong>Methods relating to Prescriptions</strong>
|<nowiki>http://ptsservername/PTSWeb/api/Prescriptions</nowiki>
|-
|<strong>Methods relating to Events (activities recorded against prescriptions)</strong>
|<nowiki>http://ptsservername/PTSWeb/api/Events</nowiki>
|-
|<strong>Methods relating to Notes</strong>
|<nowiki>http://ptsservername/PTSWeb/api/Notes</nowiki>
|-
|<strong>Methods relating to Users</strong>
|<nowiki>http://ptsservername/PTSWeb/api/Users</nowiki>
|}
 
“ptsservername” will need to be replaced by the name of the server that is hosting PTS5.
 
“PTSWeb” is the default path for installations. This may be different for your installation.
 
By default, only API calls that return patient identifiable data will expect any credentials to be passed. These credentials form a username and password that are sent in the GET request query string. To secure these credentials it is recommended that the PTS application is accessed via HTTPS.
=Common API Objects=
==PTSAPIEvent==
Many methods use a PTSAPIEvent object as an input parameter.
 
{| class="wikitable"
!Property
!Data Type
|-
|<strong>userBarcode</strong>
|String
|-
|<strong>targetId</strong>
|Integer
|-
|<strong>targetType</strong>
|TargetType (Integer)
|-
|<strong>activityId</strong>
|Integer
|-
|<strong>dateRecorded</strong>
|Date
|-
|<strong>quantity</strong>
|Integer
|-
|<strong>userPassword</strong>
|String
|}
 
==PTSAPIResponse==
When called the API commonly returns one of the following objects.
 
{| class="wikitable"
!Property
!Data Type
|-
|<strong>ResponseText</strong>
|String
|-
|<strong>ResponseScannerText</strong>
|String
|-
|<strong>WasError</strong>
|Boolean
|-
|<strong>Prescription</strong>
|SimplePrescriptionAPI Object (can be null)
|}

Revision as of 10:42, 18 July 2022

PTS 5 now includes a self-documenting application programming interface (API).

The PTS 5 API is an HTTP REST API and implements the open source Swagger UI API self-documenting tool. The documentation can be accessed by simply appending /swagger to the end of your PTS URL, e.g.: http://YourPTSServer/PTSWeb/swagger

The Swagger implementation for our live PTS 5 demo, which is constantly updated to the latest version, can be found here: http://prescriptiontracking.co.uk/swagger