The Widgets API

Other APIs

  1. API Introduction
  2. Forms GET
  3. Fields GET
  4. Entries GET / POST
  5. Users GET
  6. Reports GET
  7. Widgets GET
  8. Comments GET
  9. Web Hooks PUT / DELETE
  10. Login POST
  11. Examples
  12. The Wufoo REST Principles


Introduction

The Widgetes API is used to gather details about the widgets you have permission to view. Used in combination with the reports you could easily build a tool to view widgets for a given report.

Example Widgets API Call

If you are unsure how to get started with our API’s, please read our intro page for information on authenticating, sending and processing your request.

Request Format

This API accepts GET requests in the following formats:

https://{subdomain}.wufoo.com/api/v3/reports/{reportIdentifier}/widgets.{xml|json}[?pretty=true]
  • {subdomain} - This placeholder must be replaced with your subdomain.

  • {reportIdentifier} - This placeholder must be replaced with your URL or hash.

  • {xml|json} - You must choose between xml or json

  • {pretty=true} - This optional parameter formats your output as HTML for debugging through the browser.

Sample Response

Below is a sample response from a fictional call to the Reports API.

<Widget>
    <Name>Pie</Name>
    <Size>small</Size>
    <Type>pie</Typeof>
    <TypeDesc>Pie Graph</PrettyType>
    <Hash>rW00J6F8yyy7z1avOhXGm7OZbTqSzphhdMyOGwuslashZpZ9A=</Hash>
</Widget>

The <Widget> Element

The <Widget> element lives inside the parent. One <Widget> element exists for widget on your report. So, if you have 5 widgets on your report, you’ll have 5 <Widget> elements in the return value from your API call.

Values for the <Widget> element are defined below.

  • Name - Is the widget name. This is the friendly name you chose when creating this widget.

  • Size - Graphs (pie, bar, line) have the sizes small, medium and large. Field Charts (fieldChart) have a size of ‘fill’ because they always fill the container they are placed in. Big Numbers (bigNumber) have a size of ‘fixed’ because they are all one size.

  • Type - The identifier for the widget type. Valid Typeof values are fieldChart, bigNumber, bar, line, and pie.

  • TypeDesc - A user-friendly version of Typeof.

  • Hash - An unchanging value representing this widget.

The Widget Code Snippet

The Hash property of the <Widget> element is used to build the javascript for inserting widgets on html pages. The snippet for inserting a widget is shown in the example below.

<script type="text/javascript">var host = (("https:" == document.location.protocol) ? "https://" : "http://");document.write(unescape("%3Cscript src='" + host + "{subdomain}.wufoo.com/scripts/widget/embed.js?w={Hash}' type='text/javascript'%3E%3C/script%3E"));</script>

Be sure to replace the {subdomain} and {Hash} placeholders with values appropriate for your account and Widget.

Updated : October 21st, 2010