Discussions

Expand all | Collapse all

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

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

    Posted 03-19-2017 08:54
    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."


  • 2.  RE: Error code 4 ""Your ticket has expired"" when using a usertoken in an API call

    Posted 03-19-2017 12:32
    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.


  • 3.  RE: Error code 4 ""Your ticket has expired"" when using a usertoken in an API call

    Posted 01-08-2018 21:59
    it worked for a minute, then I started getting the error code 4 again, "Your ticket has expired" 
    Am I missing something?