--
Table of Contents |
---|
OpenSpecimen exposes REST APIs that can be consumed to develop custom UI and for integration with other databases. The REST APIs will be consumed by the OpenSpecimen user interface.
Common Characteristics of REST Resources
...
Invoke sessions API with valid credentials i.e. username, password, and domain. When domain is not specified, it defaults to 'openspecimen'.
HTTP Method POST URL http[s]://<host>:<port>/openspecimen/rest/ng/sessions Body Code Block { "loginName": "admin@admin.com", "password": "Login!@3", "domainName": "openspecimen" }
Response HTTP 200 OK response with following body
Code Block { "id": 1, "firstName": "Admin", "lastName": "Admin", "loginName": "admin@admin.com", "token": "NTQ1ZjZkYjktNTUyNi00YzM4LTlkNmEtYjllM2VjNDA0ZmIz", "admin": true, "instituteAdmin": false }
- Use the token field value returned by sessions API as
X-OS-API-TOKEN
HTTP header value in every API request made to OpenSpecimen. The token value is used by OpenSpecimen to establish - a) the user is authenticated, and b) to retrieve user details from database for authorisation and other purposes in request handling.
Unauthenticated APIs
Given below is list of APIs that do not require user authentication
...
Milliseconds elapsed since epoch. This mode always represents time in UTC. For example: 1487574000000 is 20th February 2017 00:00 in MDT
Code Block language js { "lastName": "Blackberry", "birthDate": 1487574000000, "pmis": [] }
Adding appropriate offset to input date/time field value. For example: 2017-02-20T06:00:00.000Z is 20th February 2017 00:00 in MDT
Code Block language js { "lastName": "Blackberry", "birthDate": "2017-02-20T07:00:00.000Z", "pmis":[] }
- Adding appropriate offset to input date/time field value. For example: 2017-02-20T00:00:00.000-0700 is 20th February 2017 00:00 in MDT
Code Block language js { "lastName": "Blackberry", "birthDate": "2017-02-20T00:00:00.000-0700", "pmis":[] }
Modules
Child pages (Children Display) |
---|
...