User Already Exist (API_ProvisionUser)

  • 0
  • 1
  • Question
  • Updated 1 month ago
  • Answered
Hey Guys,

I'm trying to create a user profile for My realm through API_ProvisionUser. I'm using Javascript/Jquery in pages section to achieve this API call.

I can create everyone's profile except the one who already has a QuickBase profile with a different realm. If I add the existing user with QuickBase UI, It is working fine but it is giving the following error when trying to add the same existing user with API...

I tried giving my Admin credentials and the user token but none of these things are working for me.

Thanks in advance.
<?xml version="1.0" ?>
<qdbapi>
<action>API_ProvisionUser</action>
<errcode>111</errcode>
<errtext>A user already exists.</errtext>
<errdetail>User already exists</errdetail>
</qdbapi>
Photo of Kirtan Patel

Kirtan Patel

  • 184 Points 100 badge 2x thumb
  • confused

Posted 1 month ago

  • 0
  • 1
In situations where the user exists - you'll have to swap out ProvisionUser for API_AddUserToRole instead. Provision user can't add someone when they already have a User ID - so you just need to add them to your specific app - AddUserToRole is the go to

Chayce Duncan | Director of Strategic Solutions
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base
Photo of Kirtan Patel

Kirtan Patel

  • 184 Points 100 badge 2x thumb
Okay. That makes sense.
The same thing is happening when we add a new user to our app via QuickBase UI?
I would imagine so. The UI has access to more Quick Base data than just whats in your app - so it knows the difference between adding a user for the first time and just adding them to your app.

If you're using JS / jQuery you can set up a condition to watch for that particular status code. If you receive it - you go to the next place and chain the following calls together => 

API_GetUserInfo (this will return the User ID so you can add them to your app)
API_AddUserToRole (this adds them to your app)

Chayce Duncan | Director of Strategic Solutions
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base
Photo of Kirtan Patel

Kirtan Patel

  • 184 Points 100 badge 2x thumb
Appreciate your help Chayce. you are a lifesaver.