The Data API provides access to data in a variety of formats, including JSON, XML, CSV, Excel, SQL, and HTML. The Data API provides several features to customize the data, including formatting, sorting, paging, filtering, column aliasing, column selection, and much more.
All datasets can be retrieved via the web service at:
https://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:
When requesting any type of data you can control the alias of each field name using the alias parameter, for example:
When requesting JSONP data you can provide a callback function using the callback parameter, for example:
When requesting any type of data you can control the casing of the field names. The following values are supported:
(default)
To specify the case of the field names use the case parameter, for example:
When requesting ARRAY data you can optionally request the programming language for the requested dataset. The following values are supported:
(default)
To specify the programming language use the code parameter, for example:
When requesting XML data you can optionally request the column meta data for the requested dataset. The following values are supported:
(default)
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:
When requesting SQL data you can optionally request the CREATE TABLE script for the data. The following values are supported:
(default)
To include the CREATE TABLE script use the create parameter, for example:
When requesting SQL data you can indicate the platform and version for the data. The following values are supported:
(default)dbp=sql&dbv=2014dbp=sql&dbv=2012dbp=sql&dbv=2008dbp=sql&dbv=2005dbp=sql&dbv=2000dbp=oracle&dbv=11gdbp=mysql&dbv=5.7
To specify the platform and version use the dbp and dbv parameters, for example:
When requesting CSV data you can specify the delimiter. The following values are supported:
(default)
To specify the delimiter for CSV data use the delimiter parameter, for example:
When requesting any type of data you can choose to download the data to a file using the download parameter, for example:
When requesting XML data you can control the element name. The following values are supported:
(default)
To specify the element name for XML data use the elementname parameter, for example:
When requesting XML data you can control whether elements/attributes with null values are returned. The following values are supported:
(default)
To specify whether elements/attributes with null values are returned use the excludenull parameter, for example:
When requesting any type of data if any errors are encountered they will be returned in the requested format, for example:
When requesting CSV data you can control how the data is escaped. The following values are supported:
(default)
To specify whether CSV data is escaped or not use the escape parameter, for example:
When requesting any type of data there is filtering available on certain field names, for example:
The web service supports the following formats:
(default)
Simply use the format parameter to request data in a specific format, for example:
When requesting XML, JSON, or JSONP data the following formatting options are supported:
(default)
To specify the formatting for XML, JSON, or JSONP data use the formatting parameter, for example:
When requesting XML data the following mapping types are supported:
(default)
To specify the mapping type for XML data use the mappingtype parameter, for example:
When requesting any type of data use the pagesize and pagenumber parameters to paginate the data returned, for example:
When requesting any type of data use the random parameter to randomize the order of the data returned, for example:
When requesting XML data you can control the root name. The following values are supported:
(default)
To specify the root name for XML data use the rootname parameter, for example:
When requesting any type of data use the rows parameter to control how many records are returned, for example:
When requesting any type of data use the select parameter or exclude parameter to control which fields are returned, for example:
When requesting XML data you can optionally request the script to shred the XML into SQL Server database columns. The following values are supported:
(default)
To shred the XML data into SQL Server database columns use the shred parameter, for example:
When requesting any type of data you can control how the data is sorted by specifying the sort parameter. The following directions are supported:
(default)
To specify how the data is sorted use the sort parameter, for example:
All of our services support SSL. Any HTTP calls are automatically redirected to HTTPS
When requesting SQL data you can control the SQL table name. The following values are supported:
(default)
To specify the SQL table name use the table parameter, for example:
To utilize your account a token parameter is required.
A token will be provided via email once your account has been setup.
When requesting SELECT, RADIO, or CHECKBOX data you should use the textfield parameter to indicate which column to use for the text field.
When requesting SELECT, RADIO, or CHECKBOX data you should use the valuefield parameter to indicate which column to use for the value field.
When requesting TABLE, SELECT, RADIO, or CHECKBOX data the following optional parameters can be specified:
Here are some examples: