Update user’s details via API

In Learn365, it’s possible to update user’s details in system (like Department, Title, etc.) and custom (can be created via this API) columns via API.

 

NOTES   

  • You can't edit the Username and User is in Course Catalog columns via the API.
  • The Custom Synchronization option is enabled for each column individually. When Custom Synchronization is enabled for a specific сolumn, Learn365 won't synchronize the information from Microsoft Azure AD for that particular column, and you'll be able to configure the information displayed in Users columns. For columns with Custom Synchronization disabled, the information will be automatically pulled from Microsoft Entra ID (Azure Active Directory).
  • You can update the details of both Learn365 and Flow365 user accounts.

 

You can update user’s details in both system and custom columns via the PUT /odata/v2/Users(‘{LoginName}’) endpoint. You can also update custom columns via the POST /odata/v2/Users('{LoginName}')/UpdateUserFieldValues endpoint.

Before updating user’s details via the PUT /odata/v2/Users(‘{LoginName}’) endpoint, you’ll need:

  • The login name of the user whose details you’re going to change. You can find this via the API by following the steps in this article.
  • If you want to update a user’s manager, you’ll need the manager's ID. You can find this via the API by following the steps in this article.
  • If you want to update information in custom columns, you’ll need their IDs. Running the GET /odata/v2/UserFields API request returns all information about every column, both system and custom. The information includes the column ID.

To update user’s details in system or custom columns via the API:

1. Go to https://api.365.systems/ and make sure you are authorized with the relevant API key.

2. In the Users section, select the PUT /odata/v2/Users(‘{LoginName}’) endpoint and select Try it out in the top right-hand corner.

3. In the LoginName field, enter the login name of the user whose details you’re updating.

4. In the user object, which is a request body, you can change any parameter. Note that:

  • Title is the only required parameter in this request. In this case, Title is user’s full name that is displayed in our system.

    NOTE   

    The PUT method used to update the user details replaces all the user information, not just the details you provide. This means that all the parameters need to be specified, otherwise the parameters that aren't stated will be overwritten with no data.

     

  • Every parameter in system columns, apart from the ManagerId, is a string. To update the ManagerId, enter the manager’s user ID.
  • To change user’s details in custom columns, in the UserFieldValues array, enter the FieldId and Value parameters, where the FieldId is the ID of the custom column and the Value is its new value.

If you want to update a user’s details in every system column and one custom column, the request might look like this:

 

{
"Department": "Research",
"Title": "Joanne Stefani",
"Email": "jstefani@compafi464.onmicrosoft.com",
"City": "Paris",
"Country": "France",
"Office": "Paris",
"JobTitle": "Researcher",
"Company": "Test Ltd.",
"ManagerId": "a98cf457-b3cc-4314-b995-d756fea98de3",
"UserFieldValues":
[
{"FieldId": "1c737e52-ee3b-45b1-aaec-cf981ade934c", "Value": "Senior"}
]
}

 

5. Select Execute to run the request.

 

Update user's details request

 

6. Go to the Response block to check the results:

  • 200 code with the updated user’s details in its body means the successful response.
  • In case of an error, the response body contains the error object with the code and message keys explaining the issue.

Update user's details response

 

To update a user’s details in custom columns via the POST /odata/v2/Users('{LoginName}')/UpdateUserFieldValues endpoint, you’ll need:

  • The login name of the user whose details you’re going to change. You can find this via the API by following the steps in this article.
  • The ID of a custom column. Running the GET /odata/v2/UserFields API request returns all information about every column, including custom ones. The information includes the column ID. 

To update a user’s details in custom columns via the API:

1. Go to https://api.365.systems/ and make sure you are authorized with the relevant API key.

2. In the Users section, select the POST /odata/v2/Users('{LoginName}')/UpdateUserFieldValues endpoint and select Try it out in the top right-hand corner.

3. In the LoginName field, enter the login name of the user whose details you’re updating.

4. In the UserFieldValues array in the request body, enter the parameters:

  • FieldId. The ID of a custom column.
  • Value. The new value for this column.

You can update multiple custom columns at once by putting more than one object ino the UserFieldValues array. In this case, the request body might look like this.

 

{
"UserFieldValues": [
{ "FieldId": "1c737e52-ee3b-45b1-aaec-cf981ade934c", "Value": "Middle"},
{ "FieldId": "d6ba00b6-692a-4b32-aa55-8cf12cd35fc7", "Value": 12}
]
}

 

5. Select Execute to run the request.

 

Update custom user's details request

 

6. Go to the Response block to check the results:

  • 200 code with an empty body means the successful response.
  • In case of an error, the response body contains the error object with the code and message keys explaining the issue.

 

Was this article helpful?
3 out of 3 found this helpful

Comments

Article is closed for comments.