Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Saving Time and Effort with the
QuickBase API
Sergio Haro
How does this help you?
Integration
– Export/Import data from external sources (SQL / MS Access)
– Automate data entry
– M...
Jump-Start with SDK @ code.intuit.com
Browser-Based
• JavaScript
- Good for db-pages (beware of cross-domain policy if usi...
How does it work?
You QuickBase
HTTP (GET or POST)
XML
HTTP Request
• URL
POST http://www.quickbase.com/db/main
HTTP Request
• URL
POST http://www.quickbase.com/db/main
• Headers
Host: www.quickbase.com
User-Agent: Mozilla/5.0 (Macint...
HTTP Request
• URL
POST http://www.quickbase.com/db/main
• Headers
Host: www.quickbase.com
User-Agent: Mozilla/5.0 (Macint...
Components of an API Call
1. Scope
• Set in the URL
• Dependent on Action
Components of an API Call
1. Scope
2. Action to perform
3. Parameters for action
Scope
1. Main
– https://www.quickbase.com/db/main
1. App
– https://www.quickbase.com/db/{app_id}
1. Table
– https://www.qu...
Components of an API Call
1. Scope
1. Action to perform
• Set in the URL, Headers, or Body
Action
• Header
QUICKBASE-ACTION: API_AddRecord
• URL
Query string: “a=API_AddRecord”
https://www.quickbase.com/db/b4ds?a=...
Components of an API Call
1. Scope
1. Action to perform
2. Parameters for action
• Set in the URL and/or Body
• Dependent ...
Parameters for Action (API_FindDBByName)
Parameter: Value
dbname: Test API
ticket: kiedzc4rtab8gqdr6
apptoken: asfkhlk35rn...
XML Parameters
<qdbapi>
<dbname>test API</dbname>
<ticket>kiedzc4rtab8gqdr6</ticket>
<apptoken>asfkhlk35rnl4nn<apptoken>
<...
XML Parameters
• URL
POST http://www.quickbase.com/db/main
• Headers
Content-Type: application/xml
Content-Length: 76
QUIC...
Form Parameters
dbname=test%20API&ticket=kiedzc4rtab8gqdr6
&apptoken=asfkhlk35rnl4nn
Form Parameters
• URL
POST http://www.quickbase.com/db/main
• Headers
Content-Type: application/x-www-form-urlencoded
Cont...
GET Request
• URL
POST
http://www.quickbase.com/db/main?a=API_FindDBByName&dbname=test%20API&ticket=kiedzc4
rtab8gqdr6&app...
What will I get back?
<?xml version="1.0" ?>
<qdbapi>
<action>API_FindDBByName</action>
<errcode>0</errcode>
<errtext>No e...
Example
09-15 02:49:58.550 I366aswux2 Process: Req: 0.013 [LB: 0.003 WS: 0.004 Q: 0.004] Bytes=[R: 0 W: 24957] Uid=5675283...
Example
Main Script Tasks:
1. Get lines from input
2. Parse lines
3. Calculate Statistics
4. Upload Statistics
Example - Create Request
string action;
// Get POST data
string data = addRecord(stats, out action);
// Create HTTP Reques...
Example - Create Body
// Create Root Document
action = "API_AddRecord";
XmlDocument doc = new XmlDocument();
XmlElement ro...
Example - Create Request
string action;
// Get POST data
string data = addRecord(stats, out action);
// Create HTTP Reques...
Example - Create Request
string action;
// Get POST data
string data = addRecord(stats, out action);
// Create HTTP Reques...
Example - Create Request
string action;
// Get POST data
string data = addRecord(stats, out action);
// Create HTTP Reques...
Resources
• Developer Resources
– http://quickbase.intuit.com/developer/
• API Guide (old)
– https://www.quickbase.com/up/...
API’S YOU SHOULD KNOW
API_Authenticate
Parameters:
– username
– password
API_AddRecord
Parameters:
– Field (name=“Field Name” or fid=“14”)
– apptoken
– ticket
API_EditRecord
Parameters:
– rid
– Field (name=“Field Name” or fid=“14”)
– apptoken
– ticket
API_DoQuery
Parameters:
– query/qid/qname
– clist
– slist
– apptoken
– ticket
Upcoming SlideShare
Loading in …5
×

Saving Time And Effort With QuickBase Api - Sergio Haro

Ever wish you could enter pages of data into QuickBase without lifting a finger? How about aggregating data from an external source but you don't want to set up your own SQL server and build your own reporting tools? Learn to rise above the native QuickBase interface and explore the vast and powerful capabilities QuickBase provides through its API's. It's time to get started with the QuickBase API and build your first tool/script/app.

  • Be the first to comment

Saving Time And Effort With QuickBase Api - Sergio Haro

  1. 1. Saving Time and Effort with the QuickBase API Sergio Haro
  2. 2. How does this help you? Integration – Export/Import data from external sources (SQL / MS Access) – Automate data entry – Mash-ups (Add QuickBase data to other websites) – See upcoming presentations ‘Connecting QuickBase with Databases’ and ‘Website Integration with QuickBase ‘ Custom Business Logic – Pull data to perform custom logic – Insert calculated data back Custom UI – Build your own app or website with QuickBase as your backing store – Bypass the native UI to simplify or expand its capabilities
  3. 3. Jump-Start with SDK @ code.intuit.com Browser-Based • JavaScript - Good for db-pages (beware of cross-domain policy if using on external websites) - http://intuitlabs.com/apps/yql-and-intuit-quickbase (Getting around cross-domain) - See upcoming sessions ‘Magic Buttons’ and ‘Building a QuickBase Mobile Application’ Scripting Languages • Ruby - http://www.ruby-lang.org - Object-oriented scripting language - Write scripts in your favorite text editor - See upcoming session ‘Integrating with QuickBase Web Services’ • VB - http://msdn.microsoft.com/en-us/vbasic/ - Build VB scripts in Visual Studio (Windows only) • Perl - http://www.perl.org/ - Write scripts in your favorite text editor General Programming Languages • C# - http://msdn.microsoft.com/en-us/vcsharp/ - Build C#apps in Visual Studio (Windows only) • Java - http://java.sun.com/ - Build Java apps with your favorite IDE (Eclipse, NetBeans, etc)
  4. 4. How does it work? You QuickBase HTTP (GET or POST) XML
  5. 5. HTTP Request • URL POST http://www.quickbase.com/db/main
  6. 6. HTTP Request • URL POST http://www.quickbase.com/db/main • Headers Host: www.quickbase.com User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: UTF-8,* Keep-Alive: 300 Connection: keep-alive
  7. 7. HTTP Request • URL POST http://www.quickbase.com/db/main • Headers Host: www.quickbase.com User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: UTF-8,* Keep-Alive: 300 Connection: keep-alive • Body foobar=true&type=unknown
  8. 8. Components of an API Call 1. Scope • Set in the URL • Dependent on Action
  9. 9. Components of an API Call 1. Scope 2. Action to perform 3. Parameters for action
  10. 10. Scope 1. Main – https://www.quickbase.com/db/main 1. App – https://www.quickbase.com/db/{app_id} 1. Table – https://www.quickbase.com/db/{table_id}
  11. 11. Components of an API Call 1. Scope 1. Action to perform • Set in the URL, Headers, or Body
  12. 12. Action • Header QUICKBASE-ACTION: API_AddRecord • URL Query string: “a=API_AddRecord” https://www.quickbase.com/db/b4ds?a=API_AddRecord • Body <qdbapi> <action>API_AddRecord</action> </qdbapi>
  13. 13. Components of an API Call 1. Scope 1. Action to perform 2. Parameters for action • Set in the URL and/or Body • Dependent on action • Encoded as XML or Form
  14. 14. Parameters for Action (API_FindDBByName) Parameter: Value dbname: Test API ticket: kiedzc4rtab8gqdr6 apptoken: asfkhlk35rnl4nn
  15. 15. XML Parameters <qdbapi> <dbname>test API</dbname> <ticket>kiedzc4rtab8gqdr6</ticket> <apptoken>asfkhlk35rnl4nn<apptoken> </qdbapi>
  16. 16. XML Parameters • URL POST http://www.quickbase.com/db/main • Headers Content-Type: application/xml Content-Length: 76 QUICKBASE-ACTION: API_FindDBByName • Body <qdbapi> <dbname>test API</dbname> <ticket>kiedzc4rtab8gqdr6</ticket> <apptoken>asfkhlk35rnl4nn<apptoken> </qdbapi>
  17. 17. Form Parameters dbname=test%20API&ticket=kiedzc4rtab8gqdr6 &apptoken=asfkhlk35rnl4nn
  18. 18. Form Parameters • URL POST http://www.quickbase.com/db/main • Headers Content-Type: application/x-www-form-urlencoded Content-Length: 76 QUICKBASE-ACTION: API_FindDBByName • Body dbname=test%20API&ticket=kiedzc4rtab8gqdr6&apptoken=asfkhlk35rnl4nn
  19. 19. GET Request • URL POST http://www.quickbase.com/db/main?a=API_FindDBByName&dbname=test%20API&ticket=kiedzc4 rtab8gqdr6&apptoken=asfkhlk35rnl4nn • Headers Content-Type: text/html • Body
  20. 20. What will I get back? <?xml version="1.0" ?> <qdbapi> <action>API_FindDBByName</action> <errcode>0</errcode> <errtext>No error</errtext> <dbid>57pa5vjf</dbid> <dbname>Test API</dbname> </qdbapi>
  21. 21. Example 09-15 02:49:58.550 I366aswux2 Process: Req: 0.013 [LB: 0.003 WS: 0.004 Q: 0.004] Bytes=[R: 0 W: 24957] Uid=56752832 OP=/db/main • Date • Time • Request ID • Logging Function • Request Time • Load Balancer time • App Server time • Queue time • Bytes Read • Bytes Written • User ID • URL
  22. 22. Example Main Script Tasks: 1. Get lines from input 2. Parse lines 3. Calculate Statistics 4. Upload Statistics
  23. 23. Example - Create Request string action; // Get POST data string data = addRecord(stats, out action); // Create HTTP Request string url = “http://www.quickbase.com/db/” + dbid; HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); // Set HTTP Headers webRequest.Method = "POST"; webRequest.ContentType = "application/xml"; webRequest.Headers.Add("QUICKBASE-ACTION", action); // Write Body byte[] postBytes = Encoding.ASCII.GetBytes(data); webRequest.ContentLength = postBytes.Length; Stream postStream = webRequest.GetRequestStream(); postStream.Write(postBytes, 0, postBytes.Length); postStream.Close();
  24. 24. Example - Create Body // Create Root Document action = "API_AddRecord"; XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("qdbapi"); XmlElement child; // Add Field child = doc.CreateElement("field"); child.SetAttribute("fid", "6"); child.InnerText = stats.webServerAverage.ToString(); root.AppendChild(child); … // Add App token child = doc.CreateElement("apptoken"); child.InnerText = "ye6wbdh59j7rbsf3txbd679ha7"; root.AppendChild(child); doc.AppendChild(root); StringWriter sw = new StringWriter(); XmlTextWriter tx = new XmlTextWriter(sw); doc.WriteTo(tx); return sw.ToString();
  25. 25. Example - Create Request string action; // Get POST data string data = addRecord(stats, out action); // Create HTTP Request string url = “http://www.quickbase.com/db/” + dbid; HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); // Set HTTP Headers webRequest.Method = "POST"; webRequest.ContentType = "application/xml"; webRequest.Headers.Add("QUICKBASE-ACTION", action); // Write Body byte[] postBytes = Encoding.ASCII.GetBytes(data); webRequest.ContentLength = postBytes.Length; Stream postStream = webRequest.GetRequestStream(); postStream.Write(postBytes, 0, postBytes.Length); postStream.Close();
  26. 26. Example - Create Request string action; // Get POST data string data = addRecord(stats, out action); // Create HTTP Request string url = “http://www.quickbase.com/db/” + dbid; HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); // Set HTTP Headers webRequest.Method = "POST"; webRequest.ContentType = "application/xml"; webRequest.Headers.Add("QUICKBASE-ACTION", action); // Write Body byte[] postBytes = Encoding.ASCII.GetBytes(data); webRequest.ContentLength = postBytes.Length; Stream postStream = webRequest.GetRequestStream(); postStream.Write(postBytes, 0, postBytes.Length); postStream.Close();
  27. 27. Example - Create Request string action; // Get POST data string data = addRecord(stats, out action); // Create HTTP Request string url = “http://www.quickbase.com/db/” + dbid; HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); // Set HTTP Headers webRequest.Method = "POST"; webRequest.ContentType = "application/xml"; webRequest.Headers.Add("QUICKBASE-ACTION", action); // Write Body byte[] postBytes = Encoding.ASCII.GetBytes(data); webRequest.ContentLength = postBytes.Length; Stream postStream = webRequest.GetRequestStream(); postStream.Write(postBytes, 0, postBytes.Length); postStream.Close();
  28. 28. Resources • Developer Resources – http://quickbase.intuit.com/developer/ • API Guide (old) – https://www.quickbase.com/up/6mztyxu8/g/rc7/en/
  29. 29. API’S YOU SHOULD KNOW
  30. 30. API_Authenticate Parameters: – username – password
  31. 31. API_AddRecord Parameters: – Field (name=“Field Name” or fid=“14”) – apptoken – ticket
  32. 32. API_EditRecord Parameters: – rid – Field (name=“Field Name” or fid=“14”) – apptoken – ticket
  33. 33. API_DoQuery Parameters: – query/qid/qname – clist – slist – apptoken – ticket

×