Error code 4 "Your ticket has expired" when using a usertoken in an API call

  • 0
  • 1
  • Question
  • Updated 10 months ago
  • Answered
  • (Edited)
Hi,



I'm trying to use a usertoken to access the QuickBase API, instead of logging in and using a ticket.

I've created a usertoken and assigned it to my app. Here is a sample request where I'm trying to use it:

POST /db/#READACTED# HTTP/1.1
Host: #READACTED#.quickbase.com
Content-Type: application/xml
QUICKBASE-ACTION: API_GetSchema
Cache-Control: no-cache
<qdbapi>
   <usertoken>#READACTED#</usertoken>
</qdbapi>

Unfortunately, this request returns the following error response:

<?xml version="1.0" ?>
<qdbapi>
    <action>API_GetSchema</action>
    <errcode>4</errcode>
    <errtext>Bad ticket</errtext>
    <errdetail>Your ticket has expired. By default, tickets expire after 12 hours of use. One-time tickets expire after 5 minutes.  Please log in again.</errdetail>
</qdbapi>

Am I missing something? Why does this mention a ticket if I'm not using one?

PS - Turns out that if I first login via a call to API_Authenticate then I can use my usertoken successfully in subsequent calls. Why does this happen when QuickBase API documentation clearly states:

"...user tokens are pre-generated, and don't require a call to API_Authenticate."
Photo of urgo

urgo

  • 122 Points 100 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of urgo

urgo

  • 122 Points 100 badge 2x thumb
I've found out what the issue is and fixed it.

The problem I've described occurred when I was using Postman to prototype some of my API calls.
I was getting the error with error code 4 in requests that included a TICKET cookie and the ticket value had expired.

In other words - Even though I specifically included a <usertoken> in my request body, the QB API was picking up the outdated TICKET cookie and failing my request. When I clear the cookie, everything works as expected.
Photo of Jason Crowley

Jason Crowley

  • 100 Points 100 badge 2x thumb
it worked for a minute, then I started getting the error code 4 again, "Your ticket has expired" 
Am I missing something?