How do you find the schema for a specific table using the PHP API SDK?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I've tried $qb->get_schema($tableID) but that does not work. It just continues to display the schema for the entire app. There's no information in the API docs that shows how one would pass a DBID, table ID, etc., although the examples show a table-level result.

Photo of BobSawyerGCM

BobSawyerGCM

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,964 Points 20k badge 2x thumb
From the API docs:

https://www.quickbase.com/api-guide/index.html#getschema.html%3FTocPath%3DQuickBase%2520API%2520Call...


Use API_GetSchema to get information about the specified application or application table.

When invoked on an application dbid, this call returns DBVars created for the application and all child table dbids.

When invoked on a table dbid, the call returns DBVars and additional table-related information such as reports, field IDs (fid), key field ID (key_fid), individual record names, base type, and the current property settings for each field. In addition, this call returns the default List All and List Changes reports.
Photo of BobSawyerGCM

BobSawyerGCM

  • 0 Points
I appreciate your response; however, simply repeating the information from the API docs that I've already pored through doesn't really answer my question. I think, however, I answered my own question when I found the "set_database_table()" function. By calling it before the get_schema() query, that selects the desired table.
Photo of BobSawyerGCM

BobSawyerGCM

  • 0 Points
So, for anyone else who stumbles across this needing to know how it's done:

$qb->set_database_table($table_id);
$schema = $qb->get_schema();
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,964 Points 20k badge 2x thumb
I would never use any of the SDKs that wrap the QuickBase HTTP API including the PHP SDK. All of these SDKs are coded using old paradigms and are not actively maintained. In every language modern APIs use asynchronous methods such as promises/futures/deferred, generators or async/await and they all provide libraries that more appropriately wrap the QuickBase HTTP API. Moreover, once you start using the QuickBase HTTP API you will soon encounter that you need to call both API methods and non-API methods. If you use a QuickBase SDK you will soon be forced into the situation where you use the SDK to call API methods and another way to call non-API methods. Save yourself some grief and use the raw QuickBase API with an appropriate asynchronous library for your language.