How to Update User Details in ALM using API

PATCH /users/{id}

Modifies a user with the provided details

Implementation Notes

Learner can modify bio, uiLocale, contentLocale, timezone. For large accounts, these are async calls. There are many other user attributes that can be updated using this API endpoint. Note that user ‘State’ cannot be updated via API.

Response Class (Status 200)

Operation successful

Example Value

{
“data”: {
“id”: “string”,
“type”: “string”,
“attributes”: {
“avatarUrl”: “string”,
“binUserId”: “string”,
“bio”: “string”,
“contentLocale”: “string”,
“email”: “string”,
“enrollOnClick”: true,
“fields”: {},
“gamificationEnabled”: true,
“lastLoginDate”: “string”,
“metadata”: {},
“name”: “string”,
“pointsEarned”: 0,
“pointsRedeemed”: 0,
“preferredResolution”: “string”,
“profile”: “string”,
“roles”: [
“string”
],
“state”: “string”,
“timeZoneCode”: “string”,
“uiLocale”: “string”,
“userType”: “string”,
“userUniqueId”: “string”
},
“relationships”: {
“account”: {
“data”: {
“type”: “string”,
“id”: “string”
}
},
“manager”: {
“data”: {
“type”: “string”,
“id”: “string”
}
}
}
}
}
    application/vnd.api+json;charset=UTF-8

Parameters

Parameter
Value
Description
Parameter Type
Data Type


    application/vnd.api+json;charset=UTF-8

The user body patch request to modify an existing user. There are three mandatory attributes. 1.email – email Id of the user. This value should be unique for every user. 2.name – Name of the user. 3.profile – Profile or designation of the user. 4.manager – userId of the Manager in relationships object. 5.fields – Active Fields or User Grouping Attributes of the user. 6.userRoles – List of Roles of the user. New Roles will be added and old roles will be removed. [“Admin”, “Author”, “Integration Admin”].
body

{
“data”: {
“id”: “usr123”,
“type”: “user”,
“attributes”: {
“email”: “example@adobetest.com”,
“name”: “Bob Alice”,
“profile”: “Employee”,
“Manager”: “11101219”,
“userRoles”: [
“Admin”,
“Learner”
]
}
}
}

Mention the id of the user for whose account, the data is being requested, which is subject to necessary permissions
path
string

Response Messages

HTTP Status Code
Reason
Response Model
Headers

400
A generic http bad request error

{
“meta”: {
“error”: “string”,
“detail”: “string”
}
}

401
A generic http unauthorized access error. Access is denied due to invalid credentials

{
“meta”: {
“error”: “string”,
“detail”: “string”
}
}

Curl 

curl -X PATCH –header ‘Content-Type: application/vnd.api+json;charset=UTF-8’ –header ‘Accept: application/vnd.api+json’ –header ‘Authorization: oauth b302c0bf277b74aefa77599’ -d ‘{
“data”: {
“id”: “15490731”,
“type”: “user”,
“attributes”: {
“email”: “email_updates%40yahoo.com”,
“enrollOnClick”: false,
“fields”: {
“Learning Categories”: [
“IT”
],
“Categories”: “Business”
},
“gamificationEnabled”: false,
“name”: “Sample Name”,
“pointsEarned”: 0,
“pointsRedeemed”: 0,
“preferredResolution”: “AUTO”,
“profile”: “Employee”,
“roles”: [
“Learner”,
“Instructor”
],
“state”: “ACTIVE”,
“userType”: “Internal”,
“userUniqueId”: “email_updates%40yahoo.com”
},
“relationships”: {
“account”: {
“data”: {
“id”: “108079”,
“type”: “account”
}
},
“manager”: {
“data”: {
“id”: “15263446”,
“type”: “user”
}
}
}
}
}’ ‘https://learningmanager.adobe.com/primeapi/v2/users/15490731’

Request URL 

https://learningmanager.adobe.com/primeapi/v2/users/15490731

Response Body 

{
links“: {
self“: “https://learningmanager.adobe.com/primeapi/v2/users/15490731”
},
data“: {
id“: “15490731”,
type“: “user”,
attributes“: {
avatarUrl“: “https://cpcontents.adobe.com/public/images/default_user_avatar.svg”,
binUserId“: “4dd4b2d5-7d27-429c-a551-642f40ef1f28”,
email“: “email_updates@yahoo.com”,
enrollOnClick“: false,
fields“: {
Learning Categories“: [
“IT”
],
Categories“: “Business”
},
gamificationEnabled“: false,
metadata“: {},
name“: “Sample Name”,
pointsEarned“: 0,
pointsRedeemed“: 0,
preferredResolution“: “AUTO”,
profile“: “Employee”,
roles“: [
“Learner”,
“Instructor”
],
state“: “ACTIVE”,
userType“: “Internal”,
userUniqueId“: “email_updates@yahoo.com”
},
relationships“: {
account“: {
data“: {
id“: “108079”,
type“: “account”
}
},
manager“: {
data“: {
id“: “15263446”,
type“: “user”
}
}
}
}
}

Response Code

200

Response Headers

{
“access-control-allow-credentials”: “true”,
“access-control-allow-headers”: “X-acap-all-roles, X-acap-account,X-acap-user,X-acap-caller-role,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, x-experience-api-version, Authorization, X-CSRF-TOKEN, X-HTTP-Method-Override, X-acap-ug-manager-scope, X-acap-extension-token”,
“access-control-allow-methods”: “GET, POST, OPTIONS, PUT, HEAD, DELETE, PATCH”,
“access-control-allow-origin”: “https://learningmanager.adobe.com”,
“access-control-expose-headers”: “Requested-Accept-Language, x-rate-limit, x-burst, x-excess-requests-per-second, Retry-After”,
“age”: “-1”,
“cache-control”: “no-cache, no-store, max-age=0, must-revalidate”,
“content-length”: “770”,
“content-type”: “application/vnd.api+json;charset=UTF-8”,
“date”: “Sun, 26 May 2024 19:22:44 GMT”,
“expires”: “-1”,
“pragma”: “no-cache”,
“requested-accept-language”: “en-GB,en-US;q=0.9,en;q=0.8”,
“server”: “openresty”,
“server-timing”: “server_resp;dur=309”,
“strict-transport-security”: “max-age=31536000; includeSubDomains”,
“x-content-type-options”: “nosniff”,
“x-frame-options”: “SAMEORIGIN”,
“x-request-id”: “gw5f92b612a269c42327ce4f40”,
“x-xss-protection”: “1”
}

The post How to Update User Details in ALM using API appeared first on eLearning.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *