Getting Started
Introduction
The Qfuse API is a basic RESTful API which takes a few key parameters, the
most important of which is the Salesforce ID passed and used to pull up the associated Qfuse site/qr data
associated with that salesforce id. The response can be sent back in JSON or XML format--whichever
is preferred for integration.
The analytics data exposed via the Qfuse API is read-only and explicitly related to the Qfuse site(s)/code(s) in
an account. There are three sets of Qfuse data which can be exposed, based on the API
call (aka the "get-" / "fetch-request"):
- QR Scan Data (i.e. analytics data for the scans of the QR Code(s))
- Mobile Analytics Data (i.e. analytics data for the interactions with the Qfuse site(s))
- Site Settings Data (i.e. general site settings and metadata)
Authentication
The API uses digest authentication. These should be passed via GET variables "api_key" and "password" in the RESTful call to the API. No data will be returned if these two variables are not sent.
Methods / Requests
Fetch QR Scans Data
GET https://api.qfuse.com/site?id=::salesforce_id::&format=::format::&api_key=::api_key::&password=::password::&fetch=qr_code_scans
Fetch Site Tracking Data
GET https://api.qfuse.com/site?id=::salesforce_id::&format=::format::&api_key=::api_key::&password=::password::&fetch=site_tracking
Fetch Site Settings Data
GET https://api.qfuse.com/site?id=::salesforce_id::&format=::format::&api_key=::api_key::&password=::password::&fetch=site
Fetch Mobile Contact Form Submissions
GET https://api.qfuse.com/site?id=::salesforce_id::&format=::format::&api_key=::api_key::&password=::password::&fetch=contact_form_submissions
Request Parameters:
The following paramaters must be passed, as defined below:
- id = the salesforce id for which you wish to retieve data (or the SITE ID if you're doing a "site" fetch request by id instead of all sites)
- byUser = 1 or 0 (default); 1 get ALL sites associated with your account
- format = the response type; valid values: xml (default), csv, and json
- api_key = your assigned api key
- password = your assigned password
- fetch = the type of data you want returned; valid values: qr_code_scans (default), site_tracking, site, and contact_form_submissions
GET https://api.qfuse.com/site?id=001E000000JMAdr&format=xml&api_key=aa4561214538b4ad181d8952e3f97833&password=butterflies66&fetch=qr_code_scans
Responses:
Response for qr_code_scans fetch:
{
"id": 20638,
"site_id": 2638,
"ip_address": "74.82.64.161",
"user_agent": "Mozilla/5.0 (BlackBerry; U; BlackBerry 9810; en-US) AppleWebKit/534.11+",
"time": 2012-08-07 13:05:45,
"host_address": "74-82-64-161.rdns.blackberry.net",
"browser": "BlackBerry",
"version": "v2.2",
"operating_system": "BlackBerry",
"country": "United States",
"region": "Vermont",
"city": "Burlington",
"zip_code": "05401",
"latitude": "38",
"longitude": "-97"
}
Response for site_tracking fetch:
{
"id": 110224,
"datetime": 2012-08-07 13:05:46,
"type": "event",
"site_id": 2638,
"ip": "74.82.64.160",
"page": "/s/qfuse/camp-wagalot",
"page_title": "Landing Page / Homepage",
"viewport": "320x358",
"browser": "Safari",
"browser_version": "534.11",
"device": "BlackBerry",
"platform": "BlackBerry",
"user_agent": "Mozilla/5.0 (BlackBerry; U; BlackBerry 9810; en-US)",
"category": "Button",
"label": "Google Local"
"value": "https://qfuse.com/s/qfuse/google-instructions"
}
Response for site fetch:
{
"id": 110224,
"user_id": 361,
"tracking_id": "1S7W",
"title": "Camp Wagalot",
"footer": "Copyright 2012",
"url_string": "camp-wagalot",
"external_url_string": "https://www.google.com",
"image": "qfuse_15e43ba33ea50dd194b1576e4f7516d7.png",
"expand_image": 1,
"header_image_options": 0,
"palette_id": 0,
"custom_styles": 1,
"creation_date": "2012-07-24 10:20:13",
"modified_date": "2012-07-24 10:20:13",
"isExternal": 0,
"password_protected": 0
"password": "cheesecake37"
"salesforce_id": "001E000000JMAdr"
}
Response for contact_form_submissions fetch:
{
"id": 110224,
"date_submitted": "2014-07-24 10:20:13",
"site_id": 3322,
"page_url": https://qfuse.com/s/qfuse/contact-us,
"json_data": {"to":"info@qfuse.com","subject":"Qfuse Mobile Site - Contact Us","Name_first_and_last":"Sean Dempsey","Phone_Number":"6035559493","Email_Address":"sean@qfuse.com","State":"IL","City":"Milton","Message":"Can I please get a bit of info on this product?","site_id":"3322"},
"visitor_data": "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; NX008HD8G Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30",
"ip_address": "192.168.0.1",
}
Error Responses
Errors are possible under the following circumstances:
- A Salesforce ID (id) is not specified OR byUser param not set to 1
- No API key (api_key) or password (password) was specified
- The API key (api_key) and password (password) are not valid (i.e. do not authenticate)
- An invalid fetch request was provided (e.g. not a valid value)
- (if byUser param provided) - API key not permitted to access data for specified site (i.e. trying to obtain data for a site other than your own)
- (if byUser param provided) - The Salesforce ID (id) is not found (i.e. not linked to any Qfuse sites)
{
"error": "A Salesforce ID was not specified"
}
Qfuse Table Schemas (Data Legends)
qr_code_scans:
TABLE `qr_code_scans` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`site_id` int(11) NOT NULL,
`ip_address` varchar(39) COLLATE utf8_unicode_ci NOT NULL,
`user_agent` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`host_address` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`browser` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`version` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`operating_system` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`country` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`region` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`city` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`zip_code` char(5) COLLATE utf8_unicode_ci DEFAULT NULL,
`latitude` float DEFAULT NULL,
`longitude` float DEFAULT NULL,
PRIMARY KEY (`id`)
);
- id: primary key
- site_id: site id qr code leads to
- ip_address: ip address of scanner
- user_agent: user agent of scanner's device
- time: datetime stamp of scan
- host_address: scanner's hostname
- browser: browser name
- version: browser version
- operating_system: operating system
- country: country
- region: state
- city: city
- zip_code: zip_code
- latitude: latitude
- longitude: longitude
site_tracking:
TABLE `site_tracking` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL,
`type` varchar(8) CHARACTER SET latin1 NOT NULL,
`site_id` int(11) NOT NULL,
`ip` varchar(128) CHARACTER SET latin1 NOT NULL,
`page` varchar(255) CHARACTER SET latin1 NOT NULL,
`viewport` varchar(30) CHARACTER SET latin1 NOT NULL,
`browser` varchar(50) CHARACTER SET latin1 NOT NULL,
`browser_version` varchar(20) CHARACTER SET latin1 NOT NULL,
`device` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`platform` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`user_agent` varchar(255) CHARACTER SET latin1 NOT NULL,
`referrer` varchar(255) CHARACTER SET latin1 NOT NULL,
`skin` int(11) NOT NULL,
`category` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
`label` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
`value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`id`)
);
- id: primary key
- datetime: timestamp of the date and time of the interaction
- type: interaction type (pageview or event)
- site_id: the id of the site the interaction took place on
- ip: the ip address of the visitor
- page: URI the interaction took place on
- viewport: the size of the visitors viewport
- browser: web browser name shortened
- browser_version: full version of the browser
- device: the device name the visitor was on
- platform: the visitors platform (Windows 7, Apple OS X, etc)
- user_agent: full user agent
- referrer: referrer
- skin: template id of the mobile site
- category: first parameter of event tracking
- label: second parameter of event tracking
- value: third parameter of event tracking
sites:
TABLE `sites`(
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL,
`tracking_id` varchar(4) collate utf8_unicode_ci NOT NULL,
`title` varchar(255) collate utf8_unicode_ci NOT NULL,
`footer` text collate utf8_unicode_ci NOT NULL,
`url_string` varchar(255) collate utf8_unicode_ci NOT NULL,
`external_url_string` varchar(255) collate utf8_unicode_ci default NULL,
`image` varchar(255) collate utf8_unicode_ci default NULL,
`expand_image` tinyint(1) NOT NULL,
`header_image_options` tinyint(1) NOT NULL,
`palette_id` varchar(3) collate utf8_unicode_ci NOT NULL,
`custom_styles` tinyint(4) NOT NULL default '0',
`main_site` tinyint(1) NOT NULL,
`creation_date` datetime NOT NULL,
`modified_date` datetime NOT NULL,
`isExternal` tinyint(4) NOT NULL,
`password_protected` tinyint(4) NOT NULL,
`password` varchar(255) collate utf8_unicode_ci default NULL,
`salesforce_id` varchar(25) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`id`)
);
- id: primary key
- user_id: foreign key to account/user id (will be the same for all your sites)
- tracking_id: four digit code used in the qr code scan
- title: title of site
- footer: footer text on site
- url_string: url-friendly title
- external_url_string: IF isExternal = 1, the external url qr code directs to
- image: uploaded header logo/image filename (if any)
- expand_image: set to 1 if the header image is full width
- header_image_options: placeholder db col; not currently used by app
- palette_id: IF custom styles != 1, the site color template chosen
- custom_styles: set to 1 if the user wishes to customize their site's appearance
- main_site: set to 1 if the site is the first site created
- creation_date: creation date of site
- modified_date: last modified date of site
- isExternal: set to 1 if the qr code directs to a third-party url
- password_protected: set to 1 if the site is password protected
- password: IF password_protected = 1, the site password
- salesforce_id: salesforce_id (i.e. client id) associated with site
mobile_contact_form_submissions:
TABLE `contact_form_submissions` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`date_submitted` datetime NOT NULL,
`site_id` int(11) DEFAULT NULL,
`site_title` VARCHAR(255) DEFAULT NULL,
`page_url` varchar(128) DEFAULT NULL,
`json_data` mediumtext NOT NULL,
`visitor_data` text NOT NULL,
`ip_address` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`)
);
- id: primary key (of the submission)
- data_submitted: date of the submission
- site_id: foreign key to the site_id
- site_title: title of the site the contact form was submitted from
- page_url: url of the site
- json_data: all submitted field data for all fields on the form (in JSON format)
- visitor_data: browser data for the submittor's user_agent
- ip_address: submittor's ip address
Notes
- At this time the Qfuse API only fetches (GETs) Qfuse data. No methods have been exposed for creating/updating records in the Qfuse database.
- The Qfuse API only provides access to the account associated with the provided API transaction key and password. In other words, a user of the API cannot query for information related to other Qfuse accounts in the system.
If you have any questions, please email sean at qfuse dot com.