Update User
PUT {{apiPath}}/environments/{{envID}}/users/{{userID}}
You can use the PUT {{apiPath}}/environments/{{envID}}/users/{{userID}} operation to update existing attribute properties. For PUT requests, the update operation removes any existing attribute property values omitted from the request body.
The recommended way to construct a PUT request is to perform a GET first and then use the response body to construct the PUT request body with your property value modifications.
The response data shows the updates for all attribute values specified in the request body.
Users who are not authenticating with PingOne must be assigned an identity provider with the identityProvider.id attribute. If identityProvider.id is not provided, PingOne is set as the default identity provider. The identityProvider.type value is read-only, and its value is dependent on the value of identityProvider.id. If identityProvider.id is not provided, the default value of identityProvider.type is PING_ONE.
Users who authenticate with an authoritative identity provider cannot self-service modify their account. Their user.identityProvider.id attribute is not null and their user.identityProvider.type attribute is not PING_ONE.
|
|
If the user does not have update access to an attribute, a |
|
You can enable multi-factor authentication by setting |
Prerequisites
-
Refer to Users and User Operations for important overview information.
Request Model
| Property | Type | Required? |
|---|---|---|
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
Array [String] |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Required |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Optional |
|
String |
Required |
Refer to the User operations data model for full property descriptions.
Body
raw ( application/json )
{
"username": "joe@example.com",
"name": {
"formatted": "Joe Smith",
"given": "Joe",
"middle": "H.",
"family": "Smith",
"honorificPrefix": "Dr.",
"honorificSuffix": "IV"
},
"nickname": "Putty",
"title": "Senior Director",
"preferredLanguage": "en-gb;q=0.8, en;q=0.7",
"locale": "en-gb",
"email": "joe@example.com",
"primaryPhone": "+1.2225554444",
"mobilePhone": "+1.4445552222",
"photo": {
"href": "{{imageUrl}}>"
},
"address": {
"streetAddress": "123 Main Street",
"locality": "Springfield",
"region": "WA",
"postalCode": "98701",
"countryCode": "US"
},
"accountId": "5",
"type": "tele",
"timezone": "America/Los_Angeles"
}
Example Request
-
cURL
-
C#
-
Go
-
HTTP
-
Java
-
jQuery
-
NodeJS
-
Python
-
PHP
-
Ruby
-
Swift
curl --location --globoff --request PUT '{{apiPath}}/environments/{{envID}}/users/{{userID}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data-raw '{
"username": "joe@example.com",
"name": {
"formatted": "Joe Smith",
"given": "Joe",
"middle": "H.",
"family": "Smith",
"honorificPrefix": "Dr.",
"honorificSuffix": "IV"
},
"nickname": "Putty",
"title": "Senior Director",
"preferredLanguage": "en-gb;q=0.8, en;q=0.7",
"locale": "en-gb",
"email": "joe@example.com",
"primaryPhone": "+1.2225554444",
"mobilePhone": "+1.4445552222",
"photo": {
"href": "{{imageUrl}}>"
},
"address": {
"streetAddress": "123 Main Street",
"locality": "Springfield",
"region": "WA",
"postalCode": "98701",
"countryCode": "US"
},
"accountId": "5",
"type": "tele",
"timezone": "America/Los_Angeles"
}'
var options = new RestClientOptions("{{apiPath}}/environments/{{envID}}/users/{{userID}}")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Put);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer {{accessToken}}");
var body = @"{" + "\n" +
@" ""username"": ""joe@example.com""," + "\n" +
@" ""name"": {" + "\n" +
@" ""formatted"": ""Joe Smith""," + "\n" +
@" ""given"": ""Joe""," + "\n" +
@" ""middle"": ""H.""," + "\n" +
@" ""family"": ""Smith""," + "\n" +
@" ""honorificPrefix"": ""Dr.""," + "\n" +
@" ""honorificSuffix"": ""IV""" + "\n" +
@" }," + "\n" +
@" ""nickname"": ""Putty""," + "\n" +
@" ""title"": ""Senior Director""," + "\n" +
@" ""preferredLanguage"": ""en-gb;q=0.8, en;q=0.7""," + "\n" +
@" ""locale"": ""en-gb""," + "\n" +
@" ""email"": ""joe@example.com""," + "\n" +
@" ""primaryPhone"": ""+1.2225554444""," + "\n" +
@" ""mobilePhone"": ""+1.4445552222""," + "\n" +
@" ""photo"": {" + "\n" +
@" ""href"": ""{{imageUrl}}>""" + "\n" +
@" }," + "\n" +
@" ""address"": {" + "\n" +
@" ""streetAddress"": ""123 Main Street""," + "\n" +
@" ""locality"": ""Springfield""," + "\n" +
@" ""region"": ""WA""," + "\n" +
@" ""postalCode"": ""98701""," + "\n" +
@" ""countryCode"": ""US""" + "\n" +
@" }," + "\n" +
@" ""accountId"": ""5""," + "\n" +
@" ""type"": ""tele""," + "\n" +
@" ""timezone"": ""America/Los_Angeles""" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{apiPath}}/environments/{{envID}}/users/{{userID}}"
method := "PUT"
payload := strings.NewReader(`{
"username": "joe@example.com",
"name": {
"formatted": "Joe Smith",
"given": "Joe",
"middle": "H.",
"family": "Smith",
"honorificPrefix": "Dr.",
"honorificSuffix": "IV"
},
"nickname": "Putty",
"title": "Senior Director",
"preferredLanguage": "en-gb;q=0.8, en;q=0.7",
"locale": "en-gb",
"email": "joe@example.com",
"primaryPhone": "+1.2225554444",
"mobilePhone": "+1.4445552222",
"photo": {
"href": "{{imageUrl}}>"
},
"address": {
"streetAddress": "123 Main Street",
"locality": "Springfield",
"region": "WA",
"postalCode": "98701",
"countryCode": "US"
},
"accountId": "5",
"type": "tele",
"timezone": "America/Los_Angeles"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer {{accessToken}}")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
PUT /environments/{{envID}}/users/{{userID}} HTTP/1.1
Host: {{apiPath}}
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"username": "joe@example.com",
"name": {
"formatted": "Joe Smith",
"given": "Joe",
"middle": "H.",
"family": "Smith",
"honorificPrefix": "Dr.",
"honorificSuffix": "IV"
},
"nickname": "Putty",
"title": "Senior Director",
"preferredLanguage": "en-gb;q=0.8, en;q=0.7",
"locale": "en-gb",
"email": "joe@example.com",
"primaryPhone": "+1.2225554444",
"mobilePhone": "+1.4445552222",
"photo": {
"href": "{{imageUrl}}>"
},
"address": {
"streetAddress": "123 Main Street",
"locality": "Springfield",
"region": "WA",
"postalCode": "98701",
"countryCode": "US"
},
"accountId": "5",
"type": "tele",
"timezone": "America/Los_Angeles"
}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"username\": \"joe@example.com\",\n \"name\": {\n \"formatted\": \"Joe Smith\",\n \"given\": \"Joe\",\n \"middle\": \"H.\",\n \"family\": \"Smith\",\n \"honorificPrefix\": \"Dr.\",\n \"honorificSuffix\": \"IV\"\n },\n \"nickname\": \"Putty\",\n \"title\": \"Senior Director\",\n \"preferredLanguage\": \"en-gb;q=0.8, en;q=0.7\",\n \"locale\": \"en-gb\",\n \"email\": \"joe@example.com\",\n \"primaryPhone\": \"+1.2225554444\",\n \"mobilePhone\": \"+1.4445552222\",\n \"photo\": {\n \"href\": \"{{imageUrl}}>\"\n },\n \"address\": {\n \"streetAddress\": \"123 Main Street\",\n \"locality\": \"Springfield\",\n \"region\": \"WA\",\n \"postalCode\": \"98701\",\n \"countryCode\": \"US\"\n },\n \"accountId\": \"5\",\n \"type\": \"tele\",\n \"timezone\": \"America/Los_Angeles\"\n}");
Request request = new Request.Builder()
.url("{{apiPath}}/environments/{{envID}}/users/{{userID}}")
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer {{accessToken}}")
.build();
Response response = client.newCall(request).execute();
var settings = {
"url": "{{apiPath}}/environments/{{envID}}/users/{{userID}}",
"method": "PUT",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{accessToken}}"
},
"data": JSON.stringify({
"username": "joe@example.com",
"name": {
"formatted": "Joe Smith",
"given": "Joe",
"middle": "H.",
"family": "Smith",
"honorificPrefix": "Dr.",
"honorificSuffix": "IV"
},
"nickname": "Putty",
"title": "Senior Director",
"preferredLanguage": "en-gb;q=0.8, en;q=0.7",
"locale": "en-gb",
"email": "joe@example.com",
"primaryPhone": "+1.2225554444",
"mobilePhone": "+1.4445552222",
"photo": {
"href": "{{imageUrl}}>"
},
"address": {
"streetAddress": "123 Main Street",
"locality": "Springfield",
"region": "WA",
"postalCode": "98701",
"countryCode": "US"
},
"accountId": "5",
"type": "tele",
"timezone": "America/Los_Angeles"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
var request = require('request');
var options = {
'method': 'PUT',
'url': '{{apiPath}}/environments/{{envID}}/users/{{userID}}',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{accessToken}}'
},
body: JSON.stringify({
"username": "joe@example.com",
"name": {
"formatted": "Joe Smith",
"given": "Joe",
"middle": "H.",
"family": "Smith",
"honorificPrefix": "Dr.",
"honorificSuffix": "IV"
},
"nickname": "Putty",
"title": "Senior Director",
"preferredLanguage": "en-gb;q=0.8, en;q=0.7",
"locale": "en-gb",
"email": "joe@example.com",
"primaryPhone": "+1.2225554444",
"mobilePhone": "+1.4445552222",
"photo": {
"href": "{{imageUrl}}>"
},
"address": {
"streetAddress": "123 Main Street",
"locality": "Springfield",
"region": "WA",
"postalCode": "98701",
"countryCode": "US"
},
"accountId": "5",
"type": "tele",
"timezone": "America/Los_Angeles"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "{{apiPath}}/environments/{{envID}}/users/{{userID}}"
payload = json.dumps({
"username": "joe@example.com",
"name": {
"formatted": "Joe Smith",
"given": "Joe",
"middle": "H.",
"family": "Smith",
"honorificPrefix": "Dr.",
"honorificSuffix": "IV"
},
"nickname": "Putty",
"title": "Senior Director",
"preferredLanguage": "en-gb;q=0.8, en;q=0.7",
"locale": "en-gb",
"email": "joe@example.com",
"primaryPhone": "+1.2225554444",
"mobilePhone": "+1.4445552222",
"photo": {
"href": "{{imageUrl}}>"
},
"address": {
"streetAddress": "123 Main Street",
"locality": "Springfield",
"region": "WA",
"postalCode": "98701",
"countryCode": "US"
},
"accountId": "5",
"type": "tele",
"timezone": "America/Los_Angeles"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{accessToken}}'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{apiPath}}/environments/{{envID}}/users/{{userID}}');
$request->setMethod(HTTP_Request2::METHOD_PUT);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/json',
'Authorization' => 'Bearer {{accessToken}}'
));
$request->setBody('{\n "username": "joe@example.com",\n "name": {\n "formatted": "Joe Smith",\n "given": "Joe",\n "middle": "H.",\n "family": "Smith",\n "honorificPrefix": "Dr.",\n "honorificSuffix": "IV"\n },\n "nickname": "Putty",\n "title": "Senior Director",\n "preferredLanguage": "en-gb;q=0.8, en;q=0.7",\n "locale": "en-gb",\n "email": "joe@example.com",\n "primaryPhone": "+1.2225554444",\n "mobilePhone": "+1.4445552222",\n "photo": {\n "href": "{{imageUrl}}>"\n },\n "address": {\n "streetAddress": "123 Main Street",\n "locality": "Springfield",\n "region": "WA",\n "postalCode": "98701",\n "countryCode": "US"\n },\n "accountId": "5",\n "type": "tele",\n "timezone": "America/Los_Angeles"\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
require "uri"
require "json"
require "net/http"
url = URI("{{apiPath}}/environments/{{envID}}/users/{{userID}}")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer {{accessToken}}"
request.body = JSON.dump({
"username": "joe@example.com",
"name": {
"formatted": "Joe Smith",
"given": "Joe",
"middle": "H.",
"family": "Smith",
"honorificPrefix": "Dr.",
"honorificSuffix": "IV"
},
"nickname": "Putty",
"title": "Senior Director",
"preferredLanguage": "en-gb;q=0.8, en;q=0.7",
"locale": "en-gb",
"email": "joe@example.com",
"primaryPhone": "+1.2225554444",
"mobilePhone": "+1.4445552222",
"photo": {
"href": "{{imageUrl}}>"
},
"address": {
"streetAddress": "123 Main Street",
"locality": "Springfield",
"region": "WA",
"postalCode": "98701",
"countryCode": "US"
},
"accountId": "5",
"type": "tele",
"timezone": "America/Los_Angeles"
})
response = http.request(request)
puts response.read_body
let parameters = "{\n \"username\": \"joe@example.com\",\n \"name\": {\n \"formatted\": \"Joe Smith\",\n \"given\": \"Joe\",\n \"middle\": \"H.\",\n \"family\": \"Smith\",\n \"honorificPrefix\": \"Dr.\",\n \"honorificSuffix\": \"IV\"\n },\n \"nickname\": \"Putty\",\n \"title\": \"Senior Director\",\n \"preferredLanguage\": \"en-gb;q=0.8, en;q=0.7\",\n \"locale\": \"en-gb\",\n \"email\": \"joe@example.com\",\n \"primaryPhone\": \"+1.2225554444\",\n \"mobilePhone\": \"+1.4445552222\",\n \"photo\": {\n \"href\": \"{{imageUrl}}>\"\n },\n \"address\": {\n \"streetAddress\": \"123 Main Street\",\n \"locality\": \"Springfield\",\n \"region\": \"WA\",\n \"postalCode\": \"98701\",\n \"countryCode\": \"US\"\n },\n \"accountId\": \"5\",\n \"type\": \"tele\",\n \"timezone\": \"America/Los_Angeles\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "{{apiPath}}/environments/{{envID}}/users/{{userID}}")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("Bearer {{accessToken}}", forHTTPHeaderField: "Authorization")
request.httpMethod = "PUT"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
Example Response
200 OK
{
"_links": {
"self": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8376797d-641c-4e7b-8bc1-2fdf71916cab"
},
"environment": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
},
"population": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/populations/60971d3b-cc5a-4601-9c44-2be541f91bf1"
},
"devices": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8376797d-641c-4e7b-8bc1-2fdf71916cab/devices"
},
"roleAssignments": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8376797d-641c-4e7b-8bc1-2fdf71916cab/roleAssignments"
},
"password": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8376797d-641c-4e7b-8bc1-2fdf71916cab/password"
},
"password.reset": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8376797d-641c-4e7b-8bc1-2fdf71916cab/password"
},
"password.set": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8376797d-641c-4e7b-8bc1-2fdf71916cab/password"
},
"password.check": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/58177d50-1f2b-4f08-a95c-c618c83c0669/password"
},
"password.recover": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8376797d-641c-4e7b-8bc1-2fdf71916cab/password"
},
"linkedAccounts": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8376797d-641c-4e7b-8bc1-2fdf71916cab/linkedAccounts"
},
"account.sendVerificationCode": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8376797d-641c-4e7b-8bc1-2fdf71916cab"
},
"memberOfGroups": {
"href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8376797d-641c-4e7b-8bc1-2fdf71916cab/memberOfGroups"
}
},
"id": "8376797d-641c-4e7b-8bc1-2fdf71916cab",
"environment": {
"id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
},
"account": {
"canAuthenticate": true,
"status": "OK"
},
"accountId": "5",
"address": {
"streetAddress": "123 Main Street",
"locality": "Springfield",
"region": "WA",
"postalCode": "98701",
"countryCode": "US"
},
"createdAt": "2022-10-11T16:54:38.125Z",
"email": "joe@example.com",
"enabled": true,
"identityProvider": {
"type": "PING_ONE"
},
"lastSignOn": {
"at": "2022-10-11T17:03:47.696Z",
"remoteIp": "54.86.50.139"
},
"lifecycle": {
"status": "ACCOUNT_OK"
},
"locale": "en-gb",
"mfaEnabled": false,
"mobilePhone": "+1.4445552222",
"name": {
"formatted": "Joe Smith",
"given": "Joe",
"middle": "H.",
"family": "Smith",
"honorificPrefix": "Dr.",
"honorificSuffix": "IV"
},
"nickname": "Putty",
"photo": {
"href": "https://www.google.com/imgres?imgurl=https%3A%2F%2Fwww.pingidentity.com%2Fcontent%2Fdam%2Fping-6-2-assets%2Ftopnav-json-configs%2FPing-Logo.svg&imgrefurl=https%3A%2F%2Fwww.pingidentity.com%2Fen.html&tbnid=MbFHzW8q8CvofM&vet=12ahUKEwjJo936s7P7AhVrunIEHeO2BVQQMygAegUIARDAAQ..i&docid=LNAdqRbt76nJPM&w=800&h=800&q=ping%20identity%20user&hl=en&ved=2ahUKEwjJo936s7P7AhVrunIEHeO2BVQQMygAegUIARDAAQ"
},
"population": {
"id": "60971d3b-cc5a-4601-9c44-2be541f91bf1"
},
"preferredLanguage": "en-gb;q=0.8, en;q=0.7",
"primaryPhone": "+1.2225554444",
"timezone": "America/Los_Angeles",
"title": "Senior Director",
"type": "tele",
"updatedAt": "2022-11-16T19:12:23.459Z",
"username": "joe@example.com",
"verifyStatus": "NOT_INITIATED"
}