Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NameTypeMandatoryDescription
 tokenString Yes Security Token obtained before. 
userIdStringOnly if 'temporalSession' is falseThe id of the logged in user.
temporalSessionBooleanNoDEFAULT: 'false'.
Indicates whether the provided token is temporal or not. 

...

NameTypeMandatoryDescription
{organizationId} StringYesThe id of the Organization.
tokenStringYesSecurity Token obtained before.
userIdStringOnly if 'temporalSession' is falseThe id of the logged in user.
temporalSessionBooleanNoDEFAULT: 'false'.
Indicates whether the provided token is temporal or not. 

...

NameTypeMandatoryDescription
{organizationId} StringYesThe id of the Organization.
tokenStringYesSecurity Token obtained before.
userIdStringOnly if 'temporalSession' is falseThe id of the logged in user.
temporalSessionBooleanNoDEFAULT: 'false'.
Indicates whether the provided token is temporal or not. 

...

Code Block
languagejs
titleResult
collapsetrue
{
data: [
{
id: 1,
description: "",
name: "admin",
organizationId: "UNC"
},
{
id: 2,
description: "",
name: "pod",
organizationId: "UNC"
}
],
statusFact: {
success: true
}
}

List Facility's

...

Workspaces

Current Implementation

Returns the list of all the Rooms Workspaces of a Facility has.

Parameters

Base URL: /organizations/{organizationId}/facilities/{facilityId}/roomsworkspaces
Parameters:

NameTypeMandatoryDescription
{organizationId} StringYesThe id of the Organization.
{facilityId}StringYesThe id of the Facility.
tokenStringYesSecurity Token obtained before.
userIdStringYesThe id of the logged in user.

API Sample

Happy Path

...

http://192.168.12.126109:8080/PresentationServices/organizations/UNC/facilities/UNC/roomsworkspaces?userId=sigal&token=c00145907dcaad57-c3675552-4117495b-9f55-94292996e02a&userId=superadmin

...

9aea-d5789bfabdce

Code Block
titleResult
collapselinenumberstrue
{ "data" : [ { "facilityId" : "UNC",
"id" : "podaunc_adult",
"name" : "Pod AAdults"
},
{ "facilityId" : "UNC",
"id" : "podbunc_nursery",
"name" : "Pod BNursery"
},
{ "facilityId" : "UNC"
],
"idstatusFact" : "podc",{ "namesuccess" : "Podtrue C"
},
{ "facilityId" : "UNC",
"id" : "podd",
"name" : "Pod D"
},
{ "facilityId" : "UNC",
"id" : "pode",
"name" : "Pod E"
},
{ "facilityId" : "UNC",
"id" : "podf",
"name" : "Pod F"
},
{ "facilityId" : "UNC",
"id" : "podg",
"name" : "Pod G"
}
],
"statusFact" : { "success" : true }
}

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:

...

}
}

Read Facility's Workspace

Current Implementation

Returns all the information of a particular Workspace within a Facility.

Parameters

Base URL: /organizations/{organizationId}/facilities/{facilityId}/workspaces/{workspaceId}
Parameters:

NameTypeMandatoryDescription
{organizationId} StringYesThe id of the Organization.
{facilityId}StringYesThe id of the Facility.
{workspaceId}StringYesThe id of the Workspace.
tokenStringYesSecurity Token obtained before.
userIdStringYesThe id of the logged in user.

API Sample

Happy Path

http://192.168.2.109:8080/PresentationServices/organizations/UNC/facilities/UNC/workspaces/unc_nursery?userId=sigal&token=7dcaad57-5552-495b-9aea-d5789bfabdce

Code Block
titleResult
linenumberstrue
{ "data" : { "facilityId" : "UNC",
"id" : "unc_nursery",
"name" : "Nursery"
},
"statusFact" : { "success" : true }
}

List Workspace's Rooms

Current Implementation

Returns the list of all the Rooms of a Workspace has.

Parameters

Base URL: /organizations/{organizationId}/facilities/{facilityId}/workspaces/{workspaceId}/rooms
Parameters:

NameTypeMandatoryDescription
{organizationId} StringYesThe id of the Organization.
{facilityId}StringYesThe id of the Facility.
{workspaceId}StringYesThe id of the Workspace.
tokenStringYesSecurity Token obtained before.
userIdStringYesThe id of the logged in user.

API Sample

Happy Path

http://192.168.1.126:8080/PresentationServices/organizations/UNC/facilities/UNC/rooms/poda?workspaces/unc_nursery/rooms?token=c0014590-c367-4117-9f55-94292996e02a&userId=superadmin

Code Block
languagejs
titleResult
collapsetrue
{ "data" : [ { "facilityIdworkspaceId" : "UNCunc_nursery",
"id" : "poda",
"name" : "Pod A"
},
"statusFact{ "workspaceId" : "unc_nursery",
"id" : {"podb",
"successname" : "Pod trueB"
}
}

Non Existing Room

http://192.168.1.126:8080/PresentationServices/organizations/UNC/facilities/UNC/rooms/podX?token=c0014590-c367-4117-9f55-94292996e02a&userId=superadmin

Code Block
languagejs
titleResult
collapsetrue
{ "statusFact" : { "failMessage" : "Error reading Room",
"success" : false
} }

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
  • email
  • 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:

,
{ "workspaceId" : "unc_nursery",
"id" : "podc",
"name" : "Pod C"
},
{ "workspaceId" : "unc_nursery",
"id" : "podd",
"name" : "Pod D"
},
{ "workspaceId" : "unc_nursery",
"id" : "pode",
"name" : "Pod E"
},
{ "workspaceId" : "unc_nursery",
"id" : "podf",
"name" : "Pod F"
},
{ "workspaceId" : "unc_nursery",
"id" : "podg",
"name" : "Pod G"
}
],
"statusFact" : { "success" : true }
}

Read Workspace's Room

Current Implementation

Returns all the information of a particular Room within a Workspace.

Parameters

Base URL: /organizations/{organizationId}/facilities/{facilityId}/workspaces/{workspaceId}/rooms/{roomId}
Parameters:

temporalSessionBooleanfirstName name for the new userlastName last name for the new userusernameemail email address for the new user. The email must be unique among all the users in the system.
NameTypeMandatoryDescription
token{organizationId} StringYesSecurity Token obtained beforeThe id of the Organization.
{facilityId}StringNoDEFAULT: 'false'.
Indicates whether the provided token is temporal or not. 
YesThe id of the Facility.
{workspaceId}StringYesThe id of the Workspace.
{roomId}StringYesThe id of the Room.
tokenStringYesThe username for the new user. The username must be unique among all the users in the system.Security Token obtained before.
userIdStringYesThe
passwordStringYesThe password for the new user.
At the moment, this is plain text. 
organizationStringYesThe id of the organization for the new user.
facilityStringYesThe id of the facility for the new user.
roleStringYesThe id of the role for the new user.
pinStringNoThe security pin of this user. (This pin is not still being used by the application)
tagIdStringNoThe 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

...

id of the logged in user.

API Sample

Happy Path

http://192.168.1.126:8080/PresentationServices/organizations/UNC/facilities/UNC/workspaces/unc_nursery/rooms/poda?token=c0014590-c367-4117-9f55-94292996e02a&userId=superadmin

Code Block
languagejs
titleResult
collapsetrue
{ "data" : { "facilityId" : "unc_nursery",
"id" : "poda",
"name" : "Pod A"
},
"statusFact" : { "success" : true }
}

Non Existing Room

http://192.168.1.126:8080/PresentationServices/organizations/UNC/facilities/UNC/workspaces/unc_nursery/rooms/podX?token=c0014590-c367-4117-9f55-94292996e02a&userId=superadmin

Code Block
languagejs
titleResult
collapsetrue
{ "datastatusFact" : { "emailfailMessage" : "esteban.aliverti@cogmed.com",
"facilityId" : "Vidant"Error reading Room",
"facilityNamesuccess" : "Vidant",
"firstName" : "Esteban",
"id" : "5f238a75-58e5-434e-8576-7d84f911e63e",
"username" : "eaa",
"lastName" : "Aliverti",
"organizationId" : "UNC",
"organizationName" : "UNC",
"roleId" : 1,
"roleName" : "admin",
"status" : "PENDING",
"updateDate" : "Wed May 14 10:34:44 CEST 2014"
},
"statusFact" : { "success" : true }
}

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

Code Block
languagejs
titleResult
collapsetrue
{ "data" : [ { "message" : "Malformed email: 'esteban.aliverti@cogmed'" } ],
"statusFact" : { "failMessage" : "Validation errors found",
"success" : false
}
}

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

Code Block
languagejs
titleResult
collapsetrue
{ "data" : [ { "message" : "First name is mandatory" },
{ "message" : "Facility is mandatory" }
],
"statusFact" : { "failMessage" : "Validation errors found",
"success" : false
}
}

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:

NameTypeMandatoryDescription
tokenStringYesSecurity Token obtained before.
userIdStringYesThe id of the logged in user.

API Sample

false
} }

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
  • email
  • 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 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

 

Info
The password and pin of the created user is hashed using SHA1 algorithm before it is persisted in the database.

Parameters

Base URL: /users
Parameters:

NameTypeMandatoryDescription
tokenStringYesSecurity Token obtained before.
temporalSessionBooleanNoDEFAULT: 'false'.
Indicates whether the provided token is temporal or not. 
firstNameStringYesThe name for the new user.
lastNameStringYesThe last name for the new user.
usernameStringYesThe username for the new user. The username must be unique among all the users in the system.
emailStringYesThe email address for the new user. The email must be unique among all the users in the system.
passwordStringYesThe password for the new user.
At the moment, this is plain text. 
organizationStringYesThe id of the organization for the new user.
facilityStringYesThe id of the facility for the new user.
roleStringYesThe id of the role for the new user.
pinStringNoThe security pin of this user. (This pin is not still being used by the application)
tagIdStringNoThe 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

Code Block
languagejs
titleResult
collapsetrue
{ "data" : { "email" : "esteban.aliverti@cogmed.com",
"facilityId" : "Vidant",
"facilityName" : "Vidant",
"firstName" : "Esteban",
"id" : "5f238a75-58e5-434e-8576-7d84f911e63e",
"username" : "eaa",
"lastName" : "Aliverti",
"organizationId" : "UNC",
"organizationName" : "UNC",
"roleId" : 1,
"roleName" : "admin",
"status" : "PENDING",
"updateDate" : "Wed May 14 10:34:44 CEST 2014",
"passwordSet":true, 
"tagIdSet":true, 
"pinSet":true
},
"statusFact" : { "success" : true }
}

Malformed email submitted

curl 'http://192.168.0.14:8080/PresentationServices/userStatuses?userId=sigal&token=8a4804ef-3301-4f89-a5a9-c3fed479d8c3&_=1400057312395users' -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

...

languagejs
titleResult
collapsetrue

...

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

Code Block
languagejs
titleResult
collapsetrue
{ "data" : [ { "message" : "Malformed email: 'esteban.aliverti@cogmed'" } ],
"statusFact" : { "failMessage" : "Validation errors found",
"success" : truefalse
}
}

List Users

Current Implementation

Lists all the users in the application according to a series of filter parameters.

Parameters

Base URL: /users
Parameters:

NameTypeMandatoryDescription
tokenStringYesSecurity Token obtained before.
userIdStringYesThe id of the logged in user.
locationENUMNo

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.

locationIdStringYes if location is also specified, otherwise NoThe id of the organization or facility we want to use for the filter.
statusStringNoThe 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

...

languagejs
titleResult
collapsetrue

...

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

Code Block
languagejs
titleResult
collapsetrue
{ "data" : [ { "emailmessage" : "e@e.com",
"facilityId" : "UNC",
"facilityName" : "UNC",
"firstName" : "e",
"id" : "354a7aae-ac06-4892-ac61-ce302351eb35",
"lastName" : "e",
"organizationId" : "UNC",
"organizationName" : "UNC",
"roleId" : 2,
"roleName" : "pod",
"status" : "ACTIVE",
"username" : "username-e",
"updateDate" : "2014-01-06 19:07:40.0"
},
{ "facilityId" : "UNC",
"facilityName" : "UNC",
"id" : "chargenurse",
"organizationId" : "UNC",
"organizationName" : "UNC",
"roleId" : 1,
"roleName" : "admin",
"status" : "ACTIVE",
"username" : "username-charge",
"updateDate" : "2013-03-08 01:20:37.0"
},
...First name is mandatory" },
{ "message" : "Facility is mandatory" }
],
"statusFact" : { "failMessage" : "Validation errors found",
"success" : false
}
}

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:

NameTypeMandatoryDescription
tokenStringYesSecurity Token obtained before.
userIdStringYesThe 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

Code Block
languagejs
titleResult
collapsetrue
{ "data" : [ { "value" : "ACTIVE" },
{ "value" : "PENDING" },
{ "value" : "SUSPENDED" },
{ "value" : "INACTIVE" }
],
"statusFact" : { "success" : true }
}

...

List Users

Current Implementation

Returns the information related to a UserLists all the users in the application according to a series of filter parameters.

Parameters

Base URL: /users/{requestedUserId}
Parameters:

NameTypeMandatoryDescription
{requestedUserId}StringYesThe id of the requested user.
tokenStringYesSecurity Token obtained before.
userIdStringYesThe 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

...

languagejs
titleResult
collapsetrue

...

locationENUMNo

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.

locationIdStringYes if location is also specified, otherwise NoThe id of the organization or facility we want to use for the filter.
statusStringNoThe 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

Code Block
languagejs
titleResult
collapsetrue
{ "data" : [ { "email" : "e@e.com",
roleName:
"podfacilityId", organizationId: "UNC",
firstName: "e",
facilityId"facilityName" : "UNC",
"firstName" : "UNCe",
"id" updateDate: "2014-01-06 19:07:40.0",
roleId: 2
},
statusFact: {
success: true
}
}

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:

...

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.

Code Block
languagejs
titleResult
collapsetrue
{ "data" : [ { "message" : "First name is mandatory" },
{ "message" : "Facility is mandatory" }
],
"statusFact" : { "failMessage" : "Validation errors found",
"success" : false
}
}

Parameters

Base URL: /users/{requestedUserId}
Parameters:

...

The new password for the user.
At the moment, this is plain text. If this value is not provided, the original password of the user will not be modified.

...

354a7aae-ac06-4892-ac61-ce302351eb35",
"lastName" : "e",
"organizationId" : "UNC",
"organizationName" : "UNC",
"roleId" : 2,
"roleName" : "pod",
"status" : "ACTIVE",
"username" : "username-e",
"updateDate" : "2014-01-06 19:07:40.0",
"passwordSet":true, 
"tagIdSet":true, 
"pinSet":true
},
{ "facilityId" : "UNC",
"facilityName" : "UNC",
"id" : "chargenurse",
"organizationId" : "UNC",
"organizationName" : "UNC",
"roleId" : 1,
"roleName" : "admin",
"status" : "ACTIVE",
"username" : "username-charge",
"updateDate" : "2013-03-08 01:20:37.0",
"passwordSet":true, 
"tagIdSet":true, 
"pinSet":true
},
...
],
"statusFact" : { "success" : true }
}

Read User Information

Current Implementation

Returns the information related to a User.

Parameters

Base URL: /users/{requestedUserId}
Parameters:

NameTypeMandatoryDescription
{requestedUserId}StringYesThe id of the requested user.
tokenStringYesSecurity Token obtained before.
userIdStringYesThe 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

Code Block
languagejs
titleResult
collapsetrue
{
data: {
id: "354a7aae-ac06-4892-ac61-ce302351eb35",
lastName: "e",
facilityName: "UNC",
organizationName: "UNC",
status: "ACTIVE",
username: "eaa",
email: "e@e.com",
roleName: "pod",
organizationId: "UNC",
firstName: "e",
facilityId: "UNC",
updateDate: "2014-01-06 19:07:40.0",
roleId: 2,
passwordSet:true, 
tagIdSet:true, 
pinSet:true
},
statusFact: {
success: true
}
}

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 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.

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

...

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

 

Code Block
languagejs
titleResult
collapsetrue
{ "data" : { "email" : "e@e.com",
"facilityId" : "UNC",
"facilityName" : "UNC",
"firstName" : "e",
"id" : "354a7aae-ac06-4892-ac61-ce302351eb35",
"username" : "e",
"lastName" : "e",
"organizationId" : "UNC",
"organizationName" : "UNC",
"roleId" : 2,
"roleName" : "pod",
"status" : "SUSPENDED",
"updateDate" : "Wed May 14 13:24:38 CEST 2014"
},
"statusFact" : { "success" : true }
}

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:

NameTypeMandatoryDescription
{requestedUserId}StringYesThe id of the requested user.
tokenStringYesSecurity Token obtained before.
userIdStringYesThe 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

Code Block
languagejs
titleResult
collapsetrue
{ "statusFact" : { "success" : true }}

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.

Info
This operation can be used with a temporal token.

...

  • tagId
  • email
  • username
  • pin

In the cases where the specified attribute is not available, the result will contain a field called 'takenBy' which will contains the userId of the user having it.

Parameters

Base URL: /userAttributeAvailable/{attribute}
Parameters:

NameTypeMandatoryDescription
{attribute}ENUMYesPossible values: ['tagId', 'email', 'username', 'pin'].
The User's attribute we want to check. 
tokenStringYesSecurity Token obtained before.
userIdStringOnly if 'token' is not a temporal tokenThe id of the logged in user.
temporalSessionBooleanNo

 DEFAULT: 'false'.

Indicates whether the provided token is temporal or not. 

valueStringYesThe value that we want to check.

 

API Sample

Available attribute (email)

http://localhost:8080/PresentationServices/userAttributeAvailable/email?token=d56c8e42-395e-4ba1-9bbb-73e5ed403f51&userId=poda&value=available-email@unc.org

Code Block
titleResult
collapsetrue
{
"data":{
"available":true
},
"statusFact":{
"success":true
}
}

...

current user.  

Note

UserId and Username fields can't be modified by this operation. 

 

The result in case of validation errors has the same structure as the validation errors returned by the patient creation operation.

I.e.

Code Block
languagejs
titleResult
collapsetrue
{ "data" : [ { "message" : "First name is mandatory" },
{ "message" : "Facility is mandatory" }
],
"statusFact" : { "failMessage" : "Validation errors found",
"success" : false
}
}

Parameters

Base URL: /users/{requestedUserId}
Parameters:

NameTypeMandatoryDescription
{requestedUserId}StringYesThe id of the requested user.
tokenStringYesSecurity Token obtained before.
userIdStringYesThe id of the logged in user.
firstNameStringYesThe new name for the user.
lastNameStringYesThe new last name for the user.
emailStringNoThe new email address for the user. If this parameter is not provided, the email of the user will not be modified.
passwordStringNo

The new password for the user. If this value is not provided, the original password of the user will not be modified.

organizationStringYesThe new id of the organization for the user.
facilityStringYesThe new id of the facility for the user.
roleStringYesThe new id of the role for the user.
pinStringNoThe security pin of this user. (This pin is not still being used by the application)
tagIdStringNoThe new NFC tag id for the new user. If this value is not provided, the original tagId of the user will not be modified.
passwordValidationStringIf a user is trying to modify his/her email, password and/or tagId, the argument 'passwordValidation' -> YesThe 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

 

Code Block
languagejs
titleResult
collapsetrue
{ "data" : { "email" : "e@e.com",
"facilityId" : "UNC",
"facilityName" : "UNC",
"firstName" : "e",
"id" : "354a7aae-ac06-4892-ac61-ce302351eb35",
"username" : "e",
"lastName" : "e",
"organizationId" : "UNC",
"organizationName" : "UNC",
"roleId" : 2,
"roleName" : "pod",
"status" : "SUSPENDED",
"updateDate" : "Wed May 14 13:24:38 CEST 2014",
"passwordSet":true, 
"tagIdSet":true, 
"pinSet":true
},
"statusFact" : { "success" : true }
}

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:

NameTypeMandatoryDescription
{requestedUserId}StringYesThe id of the requested user.
tokenStringYesSecurity Token obtained before.
userIdStringYesThe 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

Code Block
languagejs
titleResult
collapsetrue
{ "statusFact" : { "success" : true }}

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.

Info
This operation can be used with a temporal token.


The supported attributes are:

  • tagId
  • email
  • username
  • pin

In the cases where the specified attribute is not available, the result will contain a field called 'takenBy' which will contains the userId of the user having it.

Parameters

Base URL: /userAttributeAvailable/{attribute}
Parameters:

NameTypeMandatoryDescription
{attribute}ENUMYesPossible values: ['tagId', 'email', 'username', 'pin'].
The User's attribute we want to check. 
tokenStringYesSecurity Token obtained before.
userIdStringOnly if 'token' is not a temporal tokenThe id of the logged in user.
temporalSessionBooleanNo

 DEFAULT: 'false'.

Indicates whether the provided token is temporal or not. 

valueStringYesThe value that we want to check.

 

API Sample

Available attribute (email)

http://localhost:8080/PresentationServices/userAttributeAvailable/email?token=d56c8e42-395e-4ba1-9bbb-73e5ed403f51&userId=poda&value=available-email@unc.org

Code Block
titleResult
collapsetrue
{
"data":{
"available":true
},
"statusFact":{
"success":true
}
}


Non Available Attribute (username)

http://localhost:8080/PresentationServices/userAttributeAvailable/username?token=d56c8e42-395e-4ba1-9bbb-73e5ed403f51&userId=poda&value=10

Code Block
titleResult
collapsetrue
{
"data":{
"available":false,
"takenBy":"podb"
},
"statusFact":{
"success":true
}
}

 

Create User Name

Current Implementation

This API method can be used to create user name from first name first letter and last name. If created user name already exists in users table then add number to user name.

eg. psmith, psmith1

Parameters

Base URL: /createUserName
Parameters:

NameTypeMandatoryDescription
 firstNameString Yes First Name of user. 
lastNameStringYesLast Name of user.

 

API Sample

url 'http://localhost:8080/PresentationServices/userAttributeAvailable/usernamecreateUserName?token=d56c8e42-395e-4ba1-9bbb-73e5ed403f51&userId=poda&value=10

...

firstName=paul&lastName=paul

Code Block
languagejs
titleResult
collapsetrue
 {
"data":{
"available":false,
"takenBy"lastName":"Poda","userName":"vPoda1","firstName":"podbvidant"
},
"statusFact":{
"success":true
}
}