User API

I am sending a POST to the User API endpoint .../TDWebApi/api/people/{{uid}} with the body:

{
  "FirstName": "{{firstName}}",
  "LastName": "{{lastName}}",
  "PrimaryEmail": "{{primaryEmail}}",
  "Company": "Chico State",    
  "IsEmployee": "false",
  "IsCapacityManaged": "false",
  "ShouldReportTime": "false"
}

 

We need to uncheck these boxes:

 

The documentation shows that the IsEmployee should be editable:

When I test a populate the variables, I am receiving this error in the response body:

{"ID":-1,"Message":"Could not edit user: You cannot change a user's type via the API"}
Asked by Scott Cory on Mon 6/10/24 3:24 PM Last edited Mon 6/10/24 3:41 PM
Sign In to leave feedback or contribute an answer

Answers (2)

This answer has been marked as the accepted answer
Mark Sayers Mon 6/10/24 4:56 PM

Hi Scott,

That endpoint is meant to facilitate an edit of a user's account when you are passing their entire user API object back to the endpoint. If you only want to edit certain properties on their user account, and you already have the UID, it would be better to just use the PATCH endpoint instead.

You can cause user data to be removed if you do not POST the full user object to that POST API endpoint, but you're missing the TypeID property with an appropriate ID value for this user's Type value in that call.

Sincerely,
Mark Sayers
Sr Support Consultant, CS

No feedback
Oh, I was interpreting "type" to be "IsEmployee". We actually want to remove all user data except for the required fields because these are employee separations. I am still trying to build a workaround for not having a "Convert User to Customer" API endpoint. - Scott Cory Mon 6/10/24 5:53 PM
Ah, the TypeID property is going to be silently required always unless the account in question is a Customer already. - Mark Sayers Tue 6/11/24 9:40 AM
I am including TypeID now and the new error is:
{"ID":-1,"Message":"Could not edit user: Authentication Provider ID is invalid."}

I m using Authorization: Bearer {{authToken}} in the Header which works fine on my other administrative web service methods.
- Scott Cory Tue 6/11/24 12:27 PM
It's talking about the property for Authentication Provider on the user account. Another silent field that is required to be provided for User type accounts. - Mark Sayers Tue 6/11/24 2:39 PM
Thank you Mark, I located that and then it needed SecurityRoleID which I set to our "Client" role. 200 response now :) - Scott Cory Tue 6/11/24 2:53 PM
Awesome! - Mark Sayers Tue 6/11/24 2:59 PM

Scott Cory Tue 6/11/24 3:09 PM

This is the chain of workflow steps required to separate a user:

The reason we need a single "convert user to customer" API endpoint.

No feedback