Trying to update a 'disabled' user using script/api_key fails

Hi,

Using a script_name/api_keys for authentication I can update an “active” user but not a “disabled” user (inactive)
eg.

sg.update('HumanUser', 123, {"sg_contact_info": "123-456-7890"})

Updating an “active” user successfully returns the created data

Updating a “disabled” user gives this error:
“Missing mandatory fields: Email, Firstname and Lastname are required to activate a user under Identity”

From the FAQ:

Q. What happens to my scripts that use script_name/api_keys for authentication? Will they continue to work?
Yes. They will continue to work as they did previously, but the status of an “Active” state cannot be changed—only a scripts authenticated with username/password can do that.

As I understand it, I am NOT changing the status of an “Active” state, and I dont want to.

Anyone ideas on why this is happening? And how to fix it? I am hoping to run this in and event daemon.

–Michael

Hi @Michael_Hatton

There seems to be some code kicking in when it should not…
Can you try to include in the payload a sg_status_list that matches that user’s current value ?
I suspect that the code thinks you also want to set the user as active due to the absence of a sg_status_list param, when that is not your intent.

-Patrick

Hi Patrick,
Thanks for that. I thought the same. Support found the reason. The inactive user I was testing against had a blank lastname. email, firstname and lastname are required.
All good now.

Hi Patrick,
The issue has been resolved. The blank field (lastname) on the disabled user was the issue. Filling this field in allowed the code to run correctly. The error message was partly correct. “Missing mandatory fields: Email, Firstname and Lastname are required…”

1 Like