Table of Contents
Temporal Token Generation
Current Implementation
For those actions that don't require a registered user, a temporal token must be generated. This temporal token has access to a limited sub-set of the REST API.
A temporal token is only valid for a 5 minutes span after it is created.
Parameters
Base URL: /validateAccount
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
temporal | Boolean | Yes | Indicates that we want to create a temporal security token. |
API Sample
curl 'http://192.168.2.103:8080/PresentationServices/validateAccount?temporal=true&_=1400053144477' -H 'Origin: http://localhost' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: en-US,en;q=0.8,es;q=0.6,it;q=0.4' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.132 Safari/537.36' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: http://localhost/pqcnc2/views/loginCode.html' -H 'Connection: keep-alive' --compressed
List Organizations
Current Implementation
Normally used to fill the 'Organizations' drop down. This API method can be used with a Temporal Token. It returns the list of all the organizations in the system.
Parameters
Base URL: /organizations
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
token | String | Yes | Security Token obtained before. |
temporalSession | Boolean | No | DEFAULT: 'false'. Indicates whether the provided token is temporal or not. |
API Sample
curl 'http://64.87.15.66:8080/PresentationServices/organizations?token=4804dff3-e2cd-498e-a7f6-2239b6a8f6e2&temporalSession=true&_=1400053839602' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' --compressed
Read Organization
Current Implementation
This operation returns all the information of an individual Organization.
Parameters
Base URL: /organizations/{organizationId}
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
{organizationId} | String | Yes | The id of the Organization. |
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
API Sample
List Organization's Facilities
Current Implementation
Normally used to fill the 'Facilities' drop down. This API method can be used with a Temporal Token. It returns the list of all the facilities an Organization has.
Parameters
Base URL: /organizations/{organizationId}/facilities
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
{organizationId} | String | Yes | The id of the Organization. |
token | String | Yes | Security Token obtained before. |
temporalSession | Boolean | No | DEFAULT: 'false'. Indicates whether the provided token is temporal or not. |
API Sample
curl 'http://192.168.0.14:8080/PresentationServices/organizations/UNC/facilities?token=a0c654bf-f3d0-4c21-8e0a-f8d94ac33548&temporalSession=true&_=1400055586281' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' --compressed
Read Organization's Facility
Current Implementation
This operation returns all the information of an individual Facility.
Parameters
Base URL: /organizations/{organizationId}/facilities/{facilityId}
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
{organizationId} | String | Yes | The id of the Organization. |
{facilityId} | String | Yes | The id of the Facility |
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
API Sample
Happy Scenario
Non Existing Facility
Non matching Organization-Facility
List Organization's Roles
Current Implementation
Normally used to fill the 'Roles' drop down. This API method can be used with a Temporal Token. It returns the list of all the roles an Organization has.
Parameters
Base URL: /organizations/{organizationId}/roles
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
{organizationId} | String | Yes | The id of the Organization. |
token | String | Yes | Security Token obtained before. |
temporalSession | Boolean | No | DEFAULT: 'false'. Indicates whether the provided token is temporal or not. |
API Sample
curl 'http://192.168.0.14:8080/PresentationServices/organizations/UNC/roles?token=a0c654bf-f3d0-4c21-8e0a-f8d94ac33548&temporalSession=true&_=1400055586282' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' --compressed
List Facility's Rooms
Current Implementation
Returns the list of all the Rooms of a Facility has.
Parameters
Base URL: /organizations/{organizationId}/facilities/{facilityId}/rooms
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
{organizationId} | String | Yes | The id of the Organization. |
{facilityId} | String | Yes | The id of the Facility. |
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
API Sample
Happy Path
Read Facility's Room
Current Implementation
Returns all the information of a particular room within a Facility.
Parameters
Base URL: /organizations/{organizationId}/facilities/{facilityId}/rooms/{roomId}
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
{organizationId} | String | Yes | The id of the Organization. |
{facilityId} | String | Yes | The id of the Facility. |
{roomId} | String | Yes | The id of the Room. |
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
API Sample
Happy Path
Non Existing Room
User Registration
Current Implementation
This is a POST method. It persists a user in the database with a 'PENDING' status. Users with 'PENDING' status are not allowed to login into the application.
The following are the validations checked on the incoming data:
Mandatory fields:
- username
- firstName
- lastName
- password
- facility
- role
- status
Validations:
- A Facility with 'facility' id must exist
- A Role with 'role' id must exist
- A UserStatus with 'status' value must exist
- 'password' must be longer than 5 characters and shorter than 20
- If 'tagId' is not null, it must be unique among existing users
- If 'tagId' is not null, it must be longer than 5 characters and shorter than 20
- If 'pin' is not null, it must be unique among existing users
- If 'pin' is not null, it must be longer than 5 characters and shorter than 20
- 'email' must be a well formed email
- 'email' must be unique among existing users
- 'username' must be unique among existing users
Parameters
Base URL: /users
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
token | String | Yes | Security Token obtained before. |
temporalSession | Boolean | No | DEFAULT: 'false'. Indicates whether the provided token is temporal or not. |
firstName | String | Yes | The name for the new user. |
lastName | String | Yes | The last name for the new user. |
username | String | Yes | The username for the new user. The username must be unique among all the users in the system. |
String | Yes | The email address for the new user. The email must be unique among all the users in the system. | |
password | String | Yes | The password for the new user. At the moment, this is plain text. |
organization | String | Yes | The id of the organization for the new user. |
facility | String | Yes | The id of the facility for the new user. |
role | String | Yes | The id of the role for the new user. |
pin | String | No | The security pin of this user. (This pin is not still being used by the application) |
tagId | String | No | The NFC tag id for the new user. |
API Sample
Happy Path
curl 'http://192.168.0.14:8080/PresentationServices/users' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Origin: file://' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'firstName=Esteban&lastName=Aliverti&username=eaa&email=esteban.aliverti%40cogmed.com&password=1234&passwordConfirm=1234&organization=UNC&facility=Vidant&role=1&tagId=&token=01b1b134-71e9-4fad-9ca2-45b254e134ab&temporalSession=true' --compressed
Malformed email submitted
curl 'http://192.168.0.14:8080/PresentationServices/users' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Origin: file://' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'firstName=Esteban&lastName=Aliverti&username=eaa&email=esteban.aliverti%40cogmed&password=1234&passwordConfirm=1234&organization=UNC&facility=Vidant&role=1&tagId=&token=01b1b134-71e9-4fad-9ca2-45b254e134ab&temporalSession=true' --compressed
Mandatory fields missing
curl 'http://192.168.0.14:8080/PresentationServices/users' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Origin: file://' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'firstName=&lastName=Aliverti&username=eaa&email=esteban.aliverti%40cogmed.com&password=1234&passwordConfirm=1234&organization=UNC&facility=&role=1&tagId=&token=01b1b134-71e9-4fad-9ca2-45b254e134ab&temporalSession=true' --compressed
List possible Users Statuses
Current Implementation
Normally used to fill the 'Status' drop down for a User. It returns the list of all the statuses a User can has.
Parameters
Base URL: /userStatuses
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
API Sample
curl 'http://192.168.0.14:8080/PresentationServices/userStatuses?userId=sigal&token=8a4804ef-3301-4f89-a5a9-c3fed479d8c3&_=1400057312395' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' --compressed
List Users
Current Implementation
Lists all the users in the application according to a series of filter parameters.
Parameters
Base URL: /users
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
location | ENUM | No | Possible values: ['organization', 'facility']. Specifies whether we want to filter users by Organization or Facility. If this value is not specified the operation will return all the users from all the Organizations. The user invoking the operation in this case MUST have 'list_users_from_all_organizations' permission. |
locationId | String | Yes if location is also specified, otherwise No | The id of the organization or facility we want to use for the filter. |
status | String | No | The id of the user's status we want to use for the filter. |
API Sample
curl 'http://192.168.0.14:8080/PresentationServices/users?location=facility&locationId=UNC&status=ACTIVE&userId=sigal&token=8a4804ef-3301-4f89-a5a9-c3fed479d8c3&_=1400057312400' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' --compressed
Read User Information
Current Implementation
Returns the information related to a User.
Parameters
Base URL: /users/{requestedUserId}
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
{requestedUserId} | String | Yes | The id of the requested user. |
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
API Sample
curl 'http://192.168.0.14:8080/PresentationServices/users/354a7aae-ac06-4892-ac61-ce302351eb35?userId=sigal&token=8a4804ef-3301-4f89-a5a9-c3fed479d8c3&_=1400057312409' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' --compressed
Update User Information
Current Implementation
This is a POST method. Modifies user information such as Status, Name, Last Name, Organization, Role, etc.
The following are the validations checked on the incoming data:
Mandatory fields:
- firstName
- lastName
- password
- facility
- role
- status
Validations:
- A Facility with 'facility' id must exist
- A Role with 'role' id must exist
- A UserStatus with 'status' value must exist
- 'password' must be longer than 5 characters and shorter than 20
- If 'pin' is not null, it must unique among existing users.
- If 'pin' is not null, it must be longer than 5 characters and shorter than 20
- If 'tagId' is not null, it must unique among existing users.
- If 'tagId' is not null, it must be longer than 5 characters and shorter than 20
- If 'emai' is not null, 'email' must be a well formed email
- If 'emai' is not null, 'email' must be unique among existing users.
The result in case of validation errors has the same structure as the validation errors returned by the patient creation operation.
Important notice: If a user is trying to modify his/her email, password, pin and/or tagId, the argument 'passwordValidation' of this operation is mandatory and it must be the original (old) password of the current user.
UserId and Username fields can't be modified by this operation.
I.e.
Parameters
Base URL: /users/{requestedUserId}
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
{requestedUserId} | String | Yes | The id of the requested user. |
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
firstName | String | Yes | The new name for the user. |
lastName | String | Yes | The new last name for the user. |
String | No | The new email address for the user. If this parameter is not provided, the email of the user will not be modified. | |
password | String | No | The new password for the user. |
organization | String | Yes | The new id of the organization for the user. |
facility | String | Yes | The new id of the facility for the user. |
role | String | Yes | The new id of the role for the user. |
pin | String | No | The security pin of this user. (This pin is not still being used by the application) |
tagId | String | No | The new NFC tag id for the new user. If this value is not provided, the original tagId of the user will not be modified. |
passwordValidation | String | If a user is trying to modify his/her email, password and/or tagId, the argument 'passwordValidation' -> Yes | The original (old) password of the user. This argument is used for when a user tries to modify his/her OWN email, password and/or tag id. |
curl 'http://192.168.2.103:8080/PresentationServices/users/354a7aae-ac06-4892-ac61-ce302351eb35' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Origin: file://' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'firstName=e&lastName=e&email=e%40e.com&password=&organization=UNC&facility=UNC&role=2&status=SUSPENDED&userId=sigal&token=8a4804ef-3301-4f89-a5a9-c3fed479d8c3' --compressed
Delete User
Current Implementation
This is a DELETE method. Modifies user status to INACTIVE.
The final result is the same as using the Update User Information operation using INACTIVE as the new status.
Parameters
Base URL: /users/{requestedUserId}
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
{requestedUserId} | String | Yes | The id of the requested user. |
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
API Sample
curl -X DELETE 'http://192.168.2.103:8080/PresentationServices/users/354a7aae-ac06-4892-ac61-ce302351eb35' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Origin: file://' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --compressed
Check User's Attribute Availability
Current Implementation
This operation can be used to check whether a specific value for a specific attribute of a User is already taken by any other user.
The supported attributes are:
- tagId
- username
- pin
Parameters
Base URL: /userAttributeAvailable/{attribute}
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
{attribute} | ENUM | Yes | Possible values: ['tagId', 'email', 'username', 'pin']. The User's attribute we want to check. |
token | String | Yes | Security Token obtained before. |
userId | String | Only if 'token' is not a temporal token | The id of the logged in user. |
temporalSession | Boolean | No | DEFAULT: 'false'. Indicates whether the provided token is temporal or not. |
value | String | Yes | The value that we want to check. |
Add Comment