Forum Discussion

JosephHarburg's avatar
JosephHarburg
Qrew Trainee
3 years ago

2022 QuickBase REST API Starter Development Kit for PHP.

Hi all,
We use QuickBase for many things and love the tools it offers. We use WordPress to manage our ECommerce store and needed a way to communicate and update our QuickBase app automatically. To help solve this problem I wrote a QuickBase REST API Starter Development Kit for PHP that we currently use in a plugin for talking to QuickBase! I wanted to share this with anyone else who might need/want it for their needs. 

Here is the link to the GitHub Repo: GitHub - josephharburg/QuickBase-REST-API-PHP-SDK

GitHub remove preview
GitHub - josephharburg/QuickBase-REST-API-PHP-SDK: This is a simple class to help get started using the QuickBase REST API in PHP.
This is a simple class to be used to access the REST API that QuickBase offers for PHP. This starter development kit does not do all the work for you, however, it does give you a good leg up when trying to access the QuickBase REST API in PHP.
View this on GitHub >

Happy Coding! 
 



------------------------------
Joseph Harburg
------------------------------

4 Replies

  • Hey Joseph, thanks for this!  Super helpful for our WordPress site we are developing.  I'm intending on using this in a couple shortcodes and am hitting an unexpected error.  

    A snippet of my code:

    $QuickBaseAPI = new QuickBaseRestAPI($user_token, $app_token, $realm, $user_agent);
    $QuickBaseAPI->get_and_set_temporary_access_token($query_table);
    $video_url = $QuickBaseAPI->query_for_data($query_table, $select , $where);

    ​$user_token and $user_agent are empty strings.

    I added get_and_set_temporary_access_token because I was getting an error in query_for_data saying the access_token was empty.  Now I'm getting a "Bad Request" inside of get_and_set_temporary_access_token from line 91.  

    Any suggestions on what might be awry here?  Happy to share more code if needed.

    ------------------------------
    Jeremy Lahners
    LeadBaller
    ------------------------------
    • JosephHarburg's avatar
      JosephHarburg
      Qrew Trainee

      Hi Jeremy,
      Thank you for reaching out. 

      It appears to me that the get_and_set_temporary_access_token() method is not working properly.

      Which means I need to take a look at that code and resolve that issue. My apologies!

      Once I figure out what's wrong, I'll reply to this thread and push the fix to github.

      While I get the issue fixed, I know it should work if you create a user token and store it in your WordPress wp-config.php file as a constant.  That is if you are comfortable doing that. 

      Here is some documentation on how to create one:

      About user tokens


      Here is what that would look like with a user token:
      In your wp-config.php file add this line where appropriate: 
        define('QUICKBASE_USER_TOKEN', 'TOKENHERE'); 

      Then when you instantiate a new QuickBaseRestAPI it would look like this: 

      $QuickBaseAPI = new QuickBaseRestAPI(QUICKBASE_USER_TOKEN, $app_token, $realm, $user_agent);

      p.s. you can also store your app token in wp-config as well. 

      If you run into any issues with this please let me know and I will help out how I can. 
      Thanks!



      ------------------------------
      Joseph Harburg
      ------------------------------
      • JeremyLahners's avatar
        JeremyLahners
        Qrew Cadet
        It looks like it is related to the latest code checkin.  In the repo the extra $ is still on line 48.  I tracked that down and am getting responses now.  Also, I am not using the get_and_set method now, it appears to work without that function call.

        ------------------------------
        Jeremy Lahners
        LeadBaller
        ------------------------------