Data API Documentation

Quick Links

Summary

All datasets can be retrieved via the web service at:

  • http://mysafeinfo.com/api/data?list={listname}

Where {listname} is the unique name of the dataset you are retreiving.

This documentation refers to the states dataset and presidents dataset for purposes of demonstrating how to use all of the options available through the web service.

Additionally there is a custom configuration builder for each list that lets you customize the data, for example:

Abbreviate

When requesting any type of data the field names are standardized in all datasets using abbreviated tags, for example:

NameMeaning
amtAmount
dscDescription
idRecord ID
stState
nmName
qtyQuantity
regRegion
symSymbol
yrYear

To request non-abbeviated field names use the abbreviate parameter, for example:

Alias

When requesting any type of data you can control the alias of each field name using the alias parameter, for example:

Callback

When requesting JSONP data you can provide a callback function using the callback parameter, for example:

Case

When requesting any type of data you can control the casing of the field names. The following values are supported:

  • lower (default)
  • upper

To specify the case of the field names use the case parameter, for example:

Code

When requesting ARRAY data you can optionally request the programming language for the requested dataset. The following values are supported:

  • js (default)
  • cs
  • vb

To specify the programming language use the code parameter, for example:

Columns

When requesting XML data you can optionally request the column meta data for the requested dataset. The following values are supported:

  • false (default)
  • true

To request the column meta data for the requested dataset use the columninfo parameter, for example:

Additionally there is a special dataset for every list that will give the column meta data, for example:

Create

When requesting SQL data you can optionally request the CREATE TABLE script for the data. The following values are supported:

  • false (default)
  • true

To include the CREATE TABLE script use the create parameter, for example:

Database (platform/version)

When requesting SQL data you can indicate the platform and version for the data. The following values are supported:

  • SQL (ANSI SQL-92) (default)
  • SQL Server 2014 dbp=sql&dbv=2014
  • SQL Server 2012 dbp=sql&dbv=2012
  • SQL Server 2008 dbp=sql&dbv=2008
  • SQL Server 2005 dbp=sql&dbv=2005
  • SQL Server 2000 dbp=sql&dbv=2000
  • Oracle 11g dbp=oracle&dbv=11g
  • MySQL 5.7 dbp=mysql&dbv=5.7

To specify the platform and version use the dbp and dbv parameters, for example:

Delimiter

When requesting CSV data you can specify the delimiter. The following values are supported:

  • comma (default)
  • any non-blank value

To specify the delimiter for CSV data use the delimiter parameter, for example:

Download

When requesting any type of data you can choose to download the data to a file using the download parameter, for example:

ElementName

When requesting XML data you can control the element name. The following values are supported:

  • first letter (lower case) of the dataset being requested (default)
  • any non-blank value

To specify the element name for XML data use the elementname parameter, for example:

ExcludeNull

When requesting XML data you can control whether elements/attributes with null values are returned. The following values are supported:

  • false (default)
  • true

To specify whether elements/attributes with null values are returned use the excludenull parameter, for example:

Errors

When requesting any type of data if any errors are encountered they will be returned in the requested format, for example:

Escape

When requesting CSV data you can control how the data is escaped. The following values are supported:

  • false(default)
  • true

To specify whether CSV data is escaped or not use the escape parameter, for example:

Filtering

When requesting any type of data there is filtering available on certain field names, for example:

The specified filter parameter(s) can be the abbreviated name or non-abbeviated name regardless of which version you requested.

Format

The web service supports the following formats:

  • xml (default)
  • json
  • jsonp
  • csv
  • html
  • array
  • sql
  • excel
  • table
  • select
  • radio
  • checkbox

Simply use the format parameter to request data in a specific format, for example:

Formatting

When requesting XML, JSON, or JSONP data the following formatting options are supported:

  • indented (default)
  • none

To specify the formatting for XML, JSON, or JSONP data use the formatting parameter, for example:

MappingType

When requesting XML data the following mapping types are supported:

  • attribute (default)
  • element

To specify the mapping type for XML data use the mappingtype parameter, for example:

Random

When requesting any type of data use the random parameter to randomize the order of the data returned, for example:

RootName

When requesting XML data you can control the root name. The following values are supported:

  • dataset being requested (default)
  • any non-blank value

To specify the root name for XML data use the rootname parameter, for example:

Rows

When requesting any type of data use the rows parameter to control how many records are returned, for example:

Select, Exclude

When requesting any type of data use the select parameter or exclude parameter to control which fields are returned, for example:

The select parameter or exclude parameter can be the abbreviated name or non-abbeviated name regardless of which version you requested.

Shred

When requesting XML data you can optionally request the script to shred the XML into SQL Server database columns. The following values are supported:

  • false (default)
  • true

To shred the XML data into SQL Server database columns use the shred parameter, for example:

Sorting

When requesting any type of data you can control how the data is sorted by specifying the sort parameter. The following directions are supported:

  • asc(default)
  • desc
  • ascending
  • descending

To specify how the data is sorted use the sort parameter, for example:

The sort parameter can be the abbreviated name or non-abbeviated name regardless of which version you requested.

SSL

When requesting any type of data, both http and https are supported, for example:

Table

When requesting SQL data you can control the SQL table name. The following values are supported:

  • Name of the dataset being requested (default)
  • any non-blank value

To specify the SQL table name use the table parameter, for example:

Token

When requesting any type of non-public data a token parameter is required.

A token will be provided via email once your account has been setup.

TextField

When requesting SELECT, RADIO, or CHECKBOX data you should use the textfield parameter to indicate which column to use for the text field.

ValueField

When requesting SELECT, RADIO, or CHECKBOX data you should use the valuefield parameter to indicate which column to use for the value field.

Other

When requesting TABLE, SELECT, RADIO, or CHECKBOX data the following optional parameters can be specified:

  • TABLE
    id, class, align, bgcolor, border, cellpadding, cellspacing, summary, width
  • SELECT
    id, name, autofocus, multiple, required, size, class, onfocus, onblur, onchange, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
  • RADIO
    name
  • CHECKBOX
    name

Here are some examples:

mysafeinfo.com