4

I am fairly new to the use of APIs and haven't touched Quickbase until today. I was researching the Quickbase API and it seemed as if all the examples I saw were written in XML or some similar variant. Is there a way to write code in C# that will do the same things that I saw could be done on the Quickbase website's API documentation? If you know of any code examples, please let me know.

N. Mao
  • 499
  • 1
  • 10
  • 19

3 Answers3

5

There is a QuickBase C# SDK that might help get you started.

using System;
using Intuit.QuickBase.Client;

namespace MyProgram.QB.Interaction
{
    class MyApplication
    {
        static void Main(string[] args)
        {
            var client = QuickBase.Client.QuickBase.Login("your_QB_username", "your_QB_password");
            var application = client.Connect("your_app_dbid", "your_app_token");
            var table = application.GetTable("your_table_dbid");
            table.Query();

            foreach(var record in table.Records)
            {
               Console.WriteLine(record["your_column_heading"]);
            }
            client.Logout();
        }
    }
}

There is also a QuickBase API Wrapper example as well.

Peter Lavelle
  • 1,464
  • 7
  • 11
Robert Greiner
  • 29,049
  • 9
  • 65
  • 85
  • Thanks a lot for this timely answer! Do you think that it would be easier to use the SDK or the wrapper? Also, what references do I need in order for the above code to work? – N. Mao Jul 16 '12 at 22:42
  • At first glance, I think the wrapper might be a little easier to get started with, but the SDK will require less code on your part and do alot of things behind the scenes for you, so it's kind of a tossup. I think the documentation will let you know the references you need. – Robert Greiner Jul 17 '12 at 03:25
2

Back in 2009 I wrote an .NET API for QuickBase which makes working with the platform easy, it also supports uploading and downloading of attached files.

IQuickBaseService svc = new QuickBaseService("user", "pass", "URL", "token");
Schema schema = svc.GetSchema("DBID");
Console.WriteLine("Schema : {0}", schema.Name);
Console.WriteLine("Variables - ");
for (KeyValuePair<string, string> ent in schema.Variables.OrderBy(en => en.Key)) {
    Console.WriteLine("Var: {0} = {1}", ent.Key, ent.Value);
}
for (Query q : schema.Queries) {
    // Work with queries.
}
// schema.Children
// schema.Fields
// ...
svc.SignOut();

Performing a query is simple.

QueryResult res;
res = svc.Query("tableid", 1); // Execute query number 1
res = svc.Query("tableid", "{{140.EX.'1'}}") // execute QB query text

foreach (QueryRow row in result.Rows) {
    // Do something with row, use get<type>, not all shown here.
    // row.GetBool(1);
    // row.GetInt(1);
    // row.GetLong(1);
    // row.GetFloat(1);
    // row.GetDouble(1);
    // row.GetDecimal(1);
    // row.GetString(1);
    // row.GetDate(1);
    // row.GetDateTime(1);
    // row.GetObject(1);
}
Brett Ryan
  • 26,937
  • 30
  • 128
  • 163
0

QuickBase SDK Code is now moved to github https://github.com/QuickbaseAdmirer/QuickBase-C-Sharp-SDK