Skip to content

Instantly share code, notes, and snippets.

View zackchandler's full-sized avatar

Zack Chandler zackchandler

  • Urbandoor
  • San Francisco Bay Area
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<authenticateResponse xmlns="http://developer.intuit.com/">
<authenticateResult>
<string><%= @token.fast_xs %></string>
<string><%= @message.fast_xs %></string>
<string><%= @seconds_until_next_update %></string>
<string><%= @seconds_between_runs %></string>
</authenticateResult>
class QbwcController < ApplicationController
session :off
def api
# respond successfully to a GET which some versions of the Web Connector send to verify the url
if request.get?
render :nothing => true
return
end
<QBWCXML>
<AppName>My app</AppName>
<AppID></AppID>
<AppURL>http://localhost:3000/api</AppURL>
<AppDescription></AppDescription>
<AppSupport>http://localhost:3000/api</AppSupport>
<UserName>foobar</UserName>
<OwnerID>{12F9B9B2-88F1-4fcc-B1EE-566DE1812D20}</OwnerID>
<FileID>{67F6B9B3-36F1-4fcc-B1EE-566DE1815D20}</FileID>
<QBType>QBFS</QBType>
var proxy = 'http://localhost/foobar/proxy.php';
$('form#new_customer').submit(function(){
data = '<customer>';
data += '<name>' + $('#customer_name').val() +'</name>';
data += '</customer>';
$.ajax({
url: proxy + '?api_path=customers.xml',
contentType: 'application/xml',
type: 'POST',
<?xml version="1.0"?>
<!DOCTYPE QBXML PUBLIC "-//INTUIT//DTD QBXML QBO 6.0//EN" "http://webapps.quickbooks.com/dtds/qbxmlops60.dtd">
<QBXML>
<SignonMsgsRq>
<SignonTicketRq>
<ClientDateTime>2009-07-31</ClientDateTime>
<SessionTicket>abc123:123456789</SessionTicket>
<Language>English</Language>
<AppID>108096790</AppID>
<AppVer>1</AppVer>
<?xml version="1.0"?>
<InvoiceRet>
<TxnID>87</TxnID>
<TimeCreated>2009-08-07T09:25:27</TimeCreated>
<TimeModified>2009-08-07T09:28:19</TimeModified>
<EditSequence>1</EditSequence>
<TxnNumber>87</TxnNumber>
<CustomerRef>
<ListID>27</ListID>
<FullName>Benny Jenkins</FullName>
<?php
// Loosely based on the Jason Levitt PHP Proxy example for Yahoo! Web services.
define ('HOSTNAME', 'https://myapp.servicesidekick.com/');
$path = ($_POST['api_path']) ? $_POST['api_path'] : $_GET['api_path'];
// Build url and add any parameters
$url = HOSTNAME.$path.'?';
require 'garb'
username = 'foo'
password = 'bar'
Garb::Session.login(username, password)
profile = Garb::Profile.all.select{ |p| p.title == 'foobar' }.first
options = {
:metrics => [ :visits ],
:dimensions => [ :date ]
}
report = Garb::Report.new(profile, options)
<html>
<head>
<title>Estimate</title>
<style type="text/css">
body { margin: 20px 50px 20px 50px; color: #000080; }
#customer { margin-left: 15px; }
table { width: 100%; font-size: 10px; border-collapse: collapse; }
<?xml version="1.0"?>
<customer>
<name>ABC Company</name>
<service_address>123 First St</service_address>
<service_city>Fudge</service_city>
<service_state>CA</service_state>
<service_zip_code>55555</service_zip_code>
<primary_contact_attributes>
<first_name>John</first_name>
<last_name>Doe</last_name>