SlideShare une entreprise Scribd logo
1  sur  33
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
– 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
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)
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 (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
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
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.quickbase.com/db/{table_id}
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=API_AddRecord
• Body
<qdbapi>
<action>API_AddRecord</action>
</qdbapi>
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
Parameters for Action (API_FindDBByName)
Parameter: Value
dbname: Test API
ticket: kiedzc4rtab8gqdr6
apptoken: asfkhlk35rnl4nn
XML Parameters
<qdbapi>
<dbname>test API</dbname>
<ticket>kiedzc4rtab8gqdr6</ticket>
<apptoken>asfkhlk35rnl4nn<apptoken>
</qdbapi>
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>
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
Content-Length: 76
QUICKBASE-ACTION: API_FindDBByName
• Body
dbname=test%20API&ticket=kiedzc4rtab8gqdr6&apptoken=asfkhlk35rnl4nn
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
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>
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
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 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();
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();
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();
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();
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();
Resources
• Developer Resources
– http://quickbase.intuit.com/developer/
• API Guide (old)
– https://www.quickbase.com/up/6mztyxu8/g/rc7/en/
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

Contenu connexe

Similaire à Saving Time And Effort With QuickBase Api - Sergio Haro

nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.ppt
WalaSidhom1
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
SPTechCon
 
Very Brief Intro to Catalyst
Very Brief Intro to CatalystVery Brief Intro to Catalyst
Very Brief Intro to Catalyst
Zachary Blair
 
JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformJavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
Robert Nyman
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 

Similaire à Saving Time And Effort With QuickBase Api - Sergio Haro (20)

nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.ppt
 
Going Offline with Gears And GWT
Going Offline with Gears And GWTGoing Offline with Gears And GWT
Going Offline with Gears And GWT
 
WebGUI Developers Workshop
WebGUI Developers WorkshopWebGUI Developers Workshop
WebGUI Developers Workshop
 
Cloudbase.io MoSync Reload Course
Cloudbase.io MoSync Reload CourseCloudbase.io MoSync Reload Course
Cloudbase.io MoSync Reload Course
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
 
InterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.jsInterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.js
 
Very Brief Intro to Catalyst
Very Brief Intro to CatalystVery Brief Intro to Catalyst
Very Brief Intro to Catalyst
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer Workshop
 
Forge: Under the Hood
Forge: Under the HoodForge: Under the Hood
Forge: Under the Hood
 
Azure Functions @ global azure day 2017
Azure Functions  @ global azure day 2017Azure Functions  @ global azure day 2017
Azure Functions @ global azure day 2017
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & sockets
 
JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformJavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
 
Code First with Serverless Azure Functions
Code First with Serverless Azure FunctionsCode First with Serverless Azure Functions
Code First with Serverless Azure Functions
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011
 
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developersChris O'Brien - Best bits of Azure for Office 365/SharePoint developers
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
 
Guillotina
GuillotinaGuillotina
Guillotina
 
Attractive HTML5~開発者の視点から~
Attractive HTML5~開発者の視点から~Attractive HTML5~開発者の視点から~
Attractive HTML5~開発者の視点から~
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Always on! Or not?
Always on! Or not?Always on! Or not?
Always on! Or not?
 

Plus de QuickBase, Inc.

Understanding a QuickBase App You Didn't Build
Understanding a QuickBase App You Didn't Build Understanding a QuickBase App You Didn't Build
Understanding a QuickBase App You Didn't Build
QuickBase, Inc.
 
Three Guiding Principles to Ensure Success with QuickBase
Three Guiding Principles to Ensure Success with QuickBaseThree Guiding Principles to Ensure Success with QuickBase
Three Guiding Principles to Ensure Success with QuickBase
QuickBase, Inc.
 
The 5 Best-Kept QuickBase Secrets
The 5 Best-Kept QuickBase SecretsThe 5 Best-Kept QuickBase Secrets
The 5 Best-Kept QuickBase Secrets
QuickBase, Inc.
 
Relationship Therapy: Deeper Connections for your QuickBase Apps
Relationship Therapy: Deeper Connections for your QuickBase AppsRelationship Therapy: Deeper Connections for your QuickBase Apps
Relationship Therapy: Deeper Connections for your QuickBase Apps
QuickBase, Inc.
 
QuickBase Unleashed: Building Advanced, Hybrid, and Fully Custom QuickBase Apps
QuickBase Unleashed: Building Advanced, Hybrid, and Fully Custom QuickBase AppsQuickBase Unleashed: Building Advanced, Hybrid, and Fully Custom QuickBase Apps
QuickBase Unleashed: Building Advanced, Hybrid, and Fully Custom QuickBase Apps
QuickBase, Inc.
 

Plus de QuickBase, Inc. (20)

EMPOWER2017 Sneak Peek
EMPOWER2017 Sneak PeekEMPOWER2017 Sneak Peek
EMPOWER2017 Sneak Peek
 
Inspections, Assessments and Audits, Oh My!
Inspections, Assessments and Audits, Oh My!Inspections, Assessments and Audits, Oh My!
Inspections, Assessments and Audits, Oh My!
 
Shrinking the Custom Application Development Cycle with Low-Code Platforms
Shrinking the Custom Application Development Cycle with Low-Code PlatformsShrinking the Custom Application Development Cycle with Low-Code Platforms
Shrinking the Custom Application Development Cycle with Low-Code Platforms
 
QuickBase Digital Transformation Survey Infographic
QuickBase Digital Transformation Survey InfographicQuickBase Digital Transformation Survey Infographic
QuickBase Digital Transformation Survey Infographic
 
Creating an IT Revolution within your Organization - QuickBase, Inc. at CIO V...
Creating an IT Revolution within your Organization - QuickBase, Inc. at CIO V...Creating an IT Revolution within your Organization - QuickBase, Inc. at CIO V...
Creating an IT Revolution within your Organization - QuickBase, Inc. at CIO V...
 
Guiding Principles on Effective Rapid Application Development
Guiding Principles on Effective Rapid Application Development Guiding Principles on Effective Rapid Application Development
Guiding Principles on Effective Rapid Application Development
 
Welcome from Intuit QuickBase Keynote
Welcome from Intuit QuickBase KeynoteWelcome from Intuit QuickBase Keynote
Welcome from Intuit QuickBase Keynote
 
Understanding a QuickBase App You Didn't Build
Understanding a QuickBase App You Didn't Build Understanding a QuickBase App You Didn't Build
Understanding a QuickBase App You Didn't Build
 
Three Guiding Principles to Ensure Success with QuickBase
Three Guiding Principles to Ensure Success with QuickBaseThree Guiding Principles to Ensure Success with QuickBase
Three Guiding Principles to Ensure Success with QuickBase
 
The 5 Best-Kept QuickBase Secrets
The 5 Best-Kept QuickBase SecretsThe 5 Best-Kept QuickBase Secrets
The 5 Best-Kept QuickBase Secrets
 
Relationship Therapy: Deeper Connections for your QuickBase Apps
Relationship Therapy: Deeper Connections for your QuickBase AppsRelationship Therapy: Deeper Connections for your QuickBase Apps
Relationship Therapy: Deeper Connections for your QuickBase Apps
 
QuickBase Unleashed: Building Advanced, Hybrid, and Fully Custom QuickBase Apps
QuickBase Unleashed: Building Advanced, Hybrid, and Fully Custom QuickBase AppsQuickBase Unleashed: Building Advanced, Hybrid, and Fully Custom QuickBase Apps
QuickBase Unleashed: Building Advanced, Hybrid, and Fully Custom QuickBase Apps
 
QuickBase for the Outside World: Building for Field Users, Clients and Vendors
QuickBase for the Outside World: Building for Field Users, Clients and VendorsQuickBase for the Outside World: Building for Field Users, Clients and Vendors
QuickBase for the Outside World: Building for Field Users, Clients and Vendors
 
QuickBase as an ERP
QuickBase as an ERPQuickBase as an ERP
QuickBase as an ERP
 
Notifications: Keep Your Team Moving with Perfect Reminders and Subscription ...
Notifications: Keep Your Team Moving with Perfect Reminders and Subscription ...Notifications: Keep Your Team Moving with Perfect Reminders and Subscription ...
Notifications: Keep Your Team Moving with Perfect Reminders and Subscription ...
 
Mastering Form Rules and Formulas in QuickBase
Mastering Form Rules and Formulas in QuickBaseMastering Form Rules and Formulas in QuickBase
Mastering Form Rules and Formulas in QuickBase
 
How StubHub Got Its Projects In-Line with QuickBase
How StubHub Got Its Projects In-Line with QuickBaseHow StubHub Got Its Projects In-Line with QuickBase
How StubHub Got Its Projects In-Line with QuickBase
 
How Spyder Trap Transformed Its Business with QuickBase Sync
How Spyder Trap Transformed Its Business with QuickBase SyncHow Spyder Trap Transformed Its Business with QuickBase Sync
How Spyder Trap Transformed Its Business with QuickBase Sync
 
How QuickBase Sync Will Change the Way You Solve Problems
How QuickBase Sync Will Change the Way You Solve ProblemsHow QuickBase Sync Will Change the Way You Solve Problems
How QuickBase Sync Will Change the Way You Solve Problems
 
Guiding Principles for the Low Code Revolution – Intuit QuickBase EMPOWER2015...
Guiding Principles for the Low Code Revolution – Intuit QuickBase EMPOWER2015...Guiding Principles for the Low Code Revolution – Intuit QuickBase EMPOWER2015...
Guiding Principles for the Low Code Revolution – Intuit QuickBase EMPOWER2015...
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Dernier (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Saving Time And Effort With QuickBase Api - Sergio Haro

  • 1. Saving Time and Effort with the QuickBase API Sergio Haro
  • 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. 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. How does it work? You QuickBase HTTP (GET or POST) XML
  • 5. HTTP Request • URL POST http://www.quickbase.com/db/main
  • 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. 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. Components of an API Call 1. Scope • Set in the URL • Dependent on Action
  • 9. Components of an API Call 1. Scope 2. Action to perform 3. Parameters for action
  • 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. Components of an API Call 1. Scope 1. Action to perform • Set in the URL, Headers, or Body
  • 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. 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. Parameters for Action (API_FindDBByName) Parameter: Value dbname: Test API ticket: kiedzc4rtab8gqdr6 apptoken: asfkhlk35rnl4nn
  • 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>
  • 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
  • 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. 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. Example Main Script Tasks: 1. Get lines from input 2. Parse lines 3. Calculate Statistics 4. Upload Statistics
  • 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. 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. 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. 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. 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. Resources • Developer Resources – http://quickbase.intuit.com/developer/ • API Guide (old) – https://www.quickbase.com/up/6mztyxu8/g/rc7/en/
  • 31. API_AddRecord Parameters: – Field (name=“Field Name” or fid=“14”) – apptoken – ticket
  • 32. API_EditRecord Parameters: – rid – Field (name=“Field Name” or fid=“14”) – apptoken – ticket

Notes de l'éditeur

  1. So how does this help you?The QuickBase API is a powerful interface giving you programmatic access to record data and application schemas.With the API, you can integrate QuickBase with the rest of your business process by pushing or pulling data to QuickBase from your other solutions.With the API, you can provide you own custom Business Logic, by pulling the necessary data from QuickBase and running you logic on that data set.With the API, you can even create your own custom UI to simplify or expand the native QuickBase interface.
  2. To get jump started with our API, try using one of the many SDK’s we provide on code.intuit.comWe have a support for a variety of different languages, with an almost indentical feature set in each one. It all depends on your language preference. And if you don’t see something you like, with the information in this session you’ll be able to write your own library in a breeze.If you want more details on either our Javascript or Ruby SDK, stay tuned for some of our upcoming presentations which will go more in depth into those particular languages.
  3. So how does the QuickBase API work?Fundamentally, it’s a simple pseudo-REST HTTP API. You simply make an HTTP request to QuickBase and QuickBase will return an answer as XML.Before we go farther, lets remind ourselves what an http request is. HTTP requests happen all the time. Its what your web browser does when you type a url into it. And it consists of 3 basic parts.
  4. It all starts with a URL. This is basically tells us where the request should go
  5. The second part of the HTTP request is the Headers. These are basically meta-data about the request. The example on the screen is a request I got using Firebug when my web browser requested a page from QuickBase.
  6. Finally, an HTTP request might also have a body. Inside the body, you put any data that you want to send to the server.The body is only sent when you perform an HTTP POST, as opposed to an HTTP GET. This is called POSTing data to the server. In your web browser, this happens whenever you submit a form. Your web browser creates an HTTP request, automatically takes the data that you entered, and sets the body of the http request to be that data.
  7. The first component is the scope. The scope of the api call basically tells us what object you want to call with the API.
  8. QuickBase can use all 3 of these pieces to form an API call.Each API call will also be made up of 3 basic components. Don’t worry, I’ll explain each one.
  9. In QuickBase, we have 3 basic objects you can make an API call on.The main object is a place holder for any API’s that doesn’t use a particular application or table.In an API call, You tell us the object by putting it in the URL as shown.
  10. The second part of any API call is the name of the action you want to take. Or in programming speak, these is the name function that should be execute with your request.You can pass us the name of the action in any part of the HTTP request.
  11. If you want to tell us the action in the header, just add a new header called Quickbase-Action.If you want to tell us the action in the URL, add a new key-value pair into the query string of the URL (basically anything after a question mark in a URL.)I won’t go into detail about the Body because the recommended way is to put the action in the URL.
  12. The last part of an API call is the parameters or arguments that are needed for the particular action you want to take. Again there are multiple ways to do this. You can provide the parameters as form-urlencoded or as xml. And you can even inter-mix the different methods.
  13. So to explain this more concretely, lets take an actual example. We’ll use API_FindDBByName. This api is pretty simple, basically, you pass in the name of an application or table and QuickBase will return the ID of that application/table if it exists.It takes 3 parameters (dbname, ticket, and apptoken). The ticket and apptoken are actually required by the majority of API’s. The ticket tells us what user to run the request as. An the apptoken is a special random string you can add to your applications to protect it from people calling API’s on it without your consent. The ticket parameter in the request is the authentication ticket. QuickBase uses this ticket to verify the caller’s identity and authority to perform the requested operation. A valid ticket will be returned when a valid user name/password is passed into any function. In particular the function API_Authenticate may be used to get a valid ticket. Only the function API_Authenticate will return a cookie with the ticket. All other API functions will only return the ticket as part of the XML response.The ticket is necessary if you are calling on behalf of a user. If you want to make a call without a ticket, you need to make sure your app is open to everyone on the internet.An apptoken can be added to each of your apps for added security. (Thus a api call would require both a ticket (specific to User) and an apptoken (specific to App).
  14. If you decide on the XML route, the format is pretty simple. The root tag should always be qdbapi. The child tags will then be names of the parameters. So your xml will always be in one layer. Always make sure to XML encode your values or you might see strange things.
  15. So to Solidify the example, this is what our http request will finally look like with XML data.
  16. The second way of passing parameters to quickbase is using form-urlencoding. This is how your browser submits forms. Basically, it’s a long string where you write the parameter names “equals” the value. Each pair is separated by the & sign. If you use this method make sure to url encode the values you pass in or you might see some funky behavior.
  17. Again, here’s an http request using form encoding
  18. Now, if you take the body of the previous request and paste it to the end of the url, you’ll achieve the very same thing. For quick tests or debugging this is great. However, be forewarned that this can be a security hole because people in the network will be able to see your data.This is why we recommend putting the data in the http request body, once you’re ready to deploy your code.
  19. So now that you’ve sent the request, what are you going to get back.Some of the API calls return HTML, or JSON. But XML is the primary format for the QuickBase API. And it looks very similar to the XML you send to us. Again the root tag is “qdbapi”.Inside of the root, you’ll find a variety of tags depending on the action. You will always get back the action, errcode, and errtext. The rest depends on the specific API you are calling. If your api was successful, the errcode will be 0. However if something went wrong you’ll see a number other than zero. Inside of the errtext you might find useful information detailing what the problem was. For API_FindDBByName, we are interested in the dbid tag.
  20. So if we want to step into some real code now. I’ll share with you one of the recent pieces of code I wrote that used the QuickBase API.So in the QuickBase PD team, as we were developing a certain new feature, we had to find a way to measure the performance benefit of introducing this feature. However, with the complexity of the codebase, we did not want to spend a lot of time instrumenting the code. What we discovered was that our web server logs actually contained pretty much every measurement we were interested in. In this case it was the request time, load balancer time, app server time, and the time spent in queues. Unfortunately, one of our simulation runs could take a very long time. Too long to stick around to input the data by hand.So I went ahead a built a script in C# that took the server logs and parsed them (extracting the necessary information). Once I had the data, I would upload the data to QuickBase. What this allowed us to do is leave our simulations running over night, and the next day I could log into QuickBase and look at all the results.
  21. My script has the same core as what I suspect most of your scripts will do. I took some input, parsed it to get the necessary information, ran some computations, and then returned the result. However, instead of doing a printf, I uploaded the data into QuickBase where I could run all sorts of fancy graphs and reportsThe portion of the code dealing with QuickBase was structured very similarly to how I outlined an http request earlier. Oh, and for the size of the script, I didn’t find the need to download and set up the C# SDK. Instead I just wrote my own http requests.
  22. So the code here is broken up into 4 sections. The first part of the code calls a helper function to build the xml body.
  23. You can see that code on this page. Unfortunately, C# has some monolothic methods for manipulating XML. Some of the newer languages can treat XML as a built in type. But anyways, the format is quite simple. The first step creates the root node. I then go and create all the children with their specified tag names and set their value. Finally, I convert my xml document into a string.
  24. Now if we go back to the main function. The next step is to create the HTTP request. This is where you set the URL.
  25. Then I set all the HTTP headers
  26. Finally, I set the body of the request. Unfortunately, C# requires me to convert the string to bytes which is why it looks so nasty.But that’s basically it. Its quite simple really, The only real work is in putting together the data that we’ll send to quickbase. The actual http request and all the heavy lifting is usually taken care of by the standard libraries of the language you choose.
  27. So these urls are some links to our API documentation. Don’t worry about copying them down. This presentation should be posted online for you all to download freely. Make sure to stay tuned for the following presentations to see some more in-depth examples that use the QuickBase API.