Forum Discussion

QuickBaseAdmi10's avatar
QuickBaseAdmi10
Qrew Trainee
2 months ago

API_GetUserInfo

Hello,

The purpose of my pipeline is to dynamically add a user via API calls. The user who submits the request to add a "new" user has to input the "new" users email address. I understand that I then need to use that email address within the API_GetUserInfo to check if the user's email exists on any realm within Quickbase. If it does, then I should use the @id response data and insert it into API_AddUserToRole -> API_SendInvitation. If it doesn't exist, then I should use API_ProvisionUser -> API_SendInvitation.

My issue is that if a user is not found within the API_GetUserInfo, it throws an error: "Quickbase reported an error: 2 : Invalid input : The user with the specified email address or username does not exist."

I have tried adding an if statement to avoid the error and simply continue on:

{% if b.json.qdbapi.user['@id'] != "" %}
true
{% endif %}

However, it still throws the error if the user is not found. Is there any way to prevent this error from occurring?

Thank you.

3 Replies

  • I should also mention, when it throws an error from the API_GetUserInfo the pipeline stops, it does not continue with the if statement 

  • DougHenning1's avatar
    DougHenning1
    Community Manager

    You could use the Get Users API, which doesn't stop processing if a user doesn't exist.

    The request body can have one or more email addresses, and you'll need to use Jinja to convert the body to JSON:

    If the user doesn't exist, it returns an empty "users" array:

    Hope that helps!

    • QuickBaseAdmi10's avatar
      QuickBaseAdmi10
      Qrew Trainee

      Sorry, never got an email (or missed it) that you responded to this thread. That's interesting, I had not come across that API - I'll give that a shot and let you know how it goes. 

      Thank you