Versions Compared

Key

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

This API is useful for mainly Update the user object.

Mandatory Fields :

  1. First Name
  2. Id
  3. Last Name
  4. Email Address
  5. Domain Name
  6. Login Name
  7. Site Names
  8. CP Titles
  9. Activity Status
  10. Department Name

Unique Field :

  1. Email Address

Non Changeable Fields :

  1. Login Name
  2. Domain Name

 

...

Method

...

URL

...

openspecimen/rest/ng/users/{userId}

Use this resource to update the user in OpenSpecimen application. Use HTTP PUT method to invoke this API by passing the below details in JSON format.

Below are the attributes which need to be sent in the request body:

Parameter
Details
idID of the user to be updated
firstNameFirst name of the user
lastNameLast name of the user
emailAddressEmail address of the user. This is a unique key for the users.
phoneNumberPhone number of the user, By default it will be blank
domainNameName of the authentication domain . For providing domain name, domain should be already registered in application. By default, it is 'openspecimen'.
loginNameLogin name through which user can sign-in to OpenSpecimen. This is a unique within the authentication domain.
instituteNameInstitute to which the user is affiliated.
primarySitePrimary work site/lab of the user. This is an optional field.
type

User type. Permissible values are - SUPER, INSTITUTE, NONE. When set to SUPER, the user will be super administrator. The values INSTITUTE and NONE are for institute admin and regular users respectively.

manageFormsBoolean indicating whether user has rights to create/update custom forms. Default value is false.
addressAddress of the user. This is an optional field
activityStatus

User status. The allowed values are - Active, Locked, Pending, Disabled.


http[s]:<host>:<port>/openspecimen/rest/ng/users/{userId}

Use this URL to update user in openSpecimen application.

Result:

The response of this request will contains the details of the updated user.

Below is the example of the update user:

...

URLopenspecimen/rest/ng/users/{userId}1
MethodPUT
Requestapplication/json
json


Code Block
{
    
languagejs
themeEclipse
linenumberstrue
{
    "id": 1,
    "lastName": "
Piterson
Admin",

    

    "firstName": "
Sam
Admin",

    

    "domainName": "
catissue
openspecimen",

    

    "emailAddress": "
sam.piterson@live
admin@admin.com",

    "loginName

    "phoneNumber": "
samPiterson
1234567890",

    "siteNames

    "loginName":
["My group", "New Site"],
    "cpTitles":["MyCp", "Test Cp"],
    
 "admin@admin.com",
    "activityStatus": "Active",

    "deptName

    "type": "
Department of onchology
SUPER",

    "comments

    "instituteName":
"bla bla bla",
    "city":"Jalgaon",
    "state":"Maharashtra",
    "country":"India",
    "zipCode":"425022",
    "faxNumber":"434343AS",
    "phoneNumber":"654323",
}

Response

{

    "id" : "1",
    "lastName":"Piterson",
    "firstName":"Sam",
    "domainName":"catissue",
    "emailAddress":"sam.piterson@live.com",
    "loginName":"samPiterson",
    "siteNames":["My group", "New Site"],
    "cpTitles":["MyCp", "Test Cp"],
    "activityStatus":"Active",
    "deptName":"Department of onchology",
    "comments":"bla bla bla",
    "city":"Jalgaon",
    "state":"Maharashtra",
    "country":"India",
    "zipCode":"425022",
    "faxNumber":"434343AS",
    "phoneNumber":"654323"
}

 

 

 

 

 "Hospital for Rare Diseases",
    "address": "HRD, New City"
}


Response


Code Block
languagejs
themeEclipse
linenumberstrue
{
    "id": 1,
    "lastName": "Admin",
    "firstName": "Admin",
    "domainName": "openspecimen",
    "emailAddress": "admin@admin.com",
    "phoneNumber": " 1234567890",
    "loginName": "admin@admin.com",
    "creationDate": 1548909110207,
    "activityStatus": "Active",
    "instituteName": "Hospital for Rare Diseases",
    "type": "SUPER",
    "address": "HRD, New City"
}


 Error Cases :

code
Applies to
Status Message
200All resourcesUser has been updated successfully
400All requestsInvalid parameters, e.g  duplicate login name, duplicate email address, blank first name etc
401All requestsAuthorization failed, user doesn’t have authority
404All requestsUser not found, user with given details not present in the system
500All requestsInternal server error, encountered server error while performing operations