Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating and Updating Users through API

AshishUpadhyay
Contributor II

 

We are attempting to create and update users through API, and for that purpose we used the Webservices API's "CreateUserExWithPassword" method to update all of the user's properties except for their "default dashboard". To update the default dashboard  we chose REST API method, while the method generally succeeds, it fails for Japanese characters, updating the first and last name as "???" after updating everything else successfully. Can someone please point out where we are making this mistake?
The REST API code snippet is provided below - 

if($config.Questionnaire[$i] -eq "OT" -or $config.Questionnaire[$i] -eq "JP")
{

$bod = "{
`"User`": {
`"ID`": `"$userId`",
`"FirstName`": `"$firstname`",
`"LastName`": `"$lastname`",
`"UserName`": `"$username`",
`"Locale`": `"ja-JP`",
`"LanguageId`": `"5`",
`"TimeZoneId`": `"Tokyo Standard Time`",
`"ForcePasswordChange`": `"True`",
`"AccountStatus`": `"$status`",
`"DefaultHomeDashboardId`": `"$dashboard`",
`"DefaultHomeWorkspaceId`": `"$workspace`"
}
}"

$pc_url = $base_url + "/api/core/system/user"

$headers = @{}
$headers.Add("Authorization", "Archer session-id=" + $session_token)

if(Invoke-RestMethod -Method PUT -Uri $pc_url -Body $bod -Headers $headers -ContentType "application/json")
{
Write-Log -Message "User $username default dashboard has been set"
}

else
{
Write-Log -Message "User $username default dashboard could not be set"
}
}

@JeffLetterman 

0 REPLIES 0