Getting a "Nullable object must have a value" When Disabling a User via the API

Problem

When using the VSA REST API to disable a user as explained in our help section. You get the following error message:

{​​​​​​​​'ResponseCode': 500, 'Status': 'Failed', 'Error': 'Nullable object must have a value.'}​​​​​​​​

Cause

There is an attribute missing from the user's record, the "DisableUntil" from the JSON response.

  {
"UserId": 87589180,
"AdminName": "329735",
"AdminPassword": "coverde9695f4a51d64a72b29a9c34b1c129b58dd8091470bfa5edd3d74e1bd9aaef4",
"Admintype": 2,
"DisableUntil": null,
"CreationDate": "2018-12-12T15:17:25.733",
"AdminScopeIds": [
"21168248811635593222129149",
"2"
],
"AdminRoleIds": [
2,
481786817
],
"FirstName": "Kaseya",
"LastName": "Test",
"DefaultStaffOrgId": "87197147124176153217817313",
"DefaultStaffDepartmentId": "41282171841258424815687848",
"Email": "noreply@kaseya.com",
"UIMode": "0",
"Attributes": null
}

Resolution or Workaround

  • We need to grab the user details, by using the Get User API endpoint.
  • Grab the json body, and modify the DisableUntil or replace the null with "1980-01-01T00:00:00" [Update the Disable Until to something like "1980-01-01T00:00:00"]
  • Then we can update the user to ensure the DisableUntil has a valid date. 
  • Use the Update User REST API endpoint.
  {
"UserId": 87589180,
"AdminName": "329735",
"AdminPassword": "coverde9695f4a51d64a72b29a9c34b1c129b58dd8091470bfa5edd3d74e1bd9aaef4",
"Admintype": 2,
"DisableUntil": "1980-01-01T00:00:00",
"CreationDate": "2018-12-12T15:17:25.733",
"AdminScopeIds": [
"21168248811635593222129149",
"2"
],
"AdminRoleIds": [
2,
481786817
],
"FirstName": "Kaseya",
"LastName": "Test",
"DefaultStaffOrgId": "87197147124176153217817313",
"DefaultStaffDepartmentId": "41282171841258424815687848",
"Email": "noreply@kaseya.com",
"UIMode": "0",
"Attributes": null
}        

Make sure to send the entire details as a body in the API call.

NOTE: The user used for the API call must have a matching Role and Scope ID to the user that you are modifying. 

Have more questions?

Contact us

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

Provide feedback for the Documentation team!

Browse this section