Versions Compared

Key

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

...

The following are the validations checked on the incoming data:

Mandatory fields:

  • username
  • firstName
  • lastName
  • email
  • password
  • facility
  • role
  • status

...

  • 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 (aka '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:

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.
tagIdStringNoThe NFC tag id (aka 'pin') for the new user.

...

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"
},
"statusFact" : { "success" : true }
}

...

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

...

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: {
id: "354a7aae-ac06-4892-ac61-ce302351eb35",
lastName: "e",
facilityName: "UNC",
organizationName: "UNC",
status: "ACTIVE",
pin: "esteban",
username: "eaa",
email: "e@e.com",
roleName: "pod",
organizationId: "UNC",
firstName: "e",
facilityId: "UNC",
updateDate: "2014-01-06 19:07:40.0",
roleId: 2
},
statusFact: {
success: true
}
}

...

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

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

...