HomeFormSpring APIMethodsdata

2.3. data

This method returns data collected for a form.

Authentication

This method requires an API key with data or write permissions for the form. If the API key does not have permissions to access the form, a 404 (not found) will be returned

Arguments

  • api_key (required)
  • id - form id (required)
  • encryption_password - data encryption password, if one is set. (optional)
  • min_time - only entries submitted after this date will be returned. YYYY-MM-DD or YYYY-MM-DD HH:MM:SS format is expected. (optional)
  • max_time - only entries submitted before this date will be returned. YYYY-MM-DD or YYYY-MM-DD HH:MM:SS format is expected. (optional)
  • search_field_x - x must be a number 0-9. name or id of the field that should be searched. should be paired with search_value_x. not implemented for encrypted data. (optional)
  • search_value_x - x must be a number 0-9. text that should be searched for within the corresponding search_field_x field. at this time all searches are case-insensitive "contains" searches. not implemented for encrypted data. (optional)
  • per_page - number of results to return per page. the default is 25 and the maximum value is 100. (optional)
  • page - the page of results that should be returned. the default is 1. (optional)

Example Request

https://www.formspring.com/api/data?api_key=ABCDE&id=111&min_date=2007-04-04&per_page=100&search_field_0=first_name&search_value_0=john&search_field_1=last_name&search_value_1=smith

Response

  • total - the total number of submissions that match the search
  • pages - the total number of pages of results, given the per_page value
  • submissions - array containing one entry per form submission
    • id - submission id, unique to each entry
    • timestamp - date/time of the submission in YYYY-MM-DD HH:MM:SS format.
    • user_agent - user agent string taken from the submitter's browser
    • remote_addr - IP address taken from the submitter
    • data - key/value pairs, with one entry per field on the form
      • field - field id
      • value - the value that was submitted for this field

Example XML Response

<?xml version="1.0" encoding="utf-8"?>
<response status="ok">
<submissions>
<submission>
<id>1001</id>
<timestamp>2007-01-01 01:01:01</timestamp>
<user_agent>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)</user_agent>
<remote_addr>127.0.0.1</remote_addr>
<data>
<item>
<field>1111</field>
<value>John Smith</value>
</item>
<item>
<field>2222</field>
<value>Apple</value>
</item>
</data>
</submission>
<submission>
<id>1001</id>
<timestamp>2007-02-02 02:02:02</timestamp>
<user_agent>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)</user_agent>
<remote_addr>127.0.0.1</remote_addr>
<data>
<item>
<field>1111</field>
<value>Jane Smith</value>
</item>
<item>
<field>2222</field>
<value>Banana</value>
</item>
</data>
</submission>
</submissions>
<total>2</total>
<pages>1</pages>
</response>

Example JSON Response

{
"status" : "ok",
"response" : {
"submissions" : [ {
"id" : "1001",
"timestamp" : "2007-01-01 01:01:01",
"user_agent" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)",
"remote_addr" : "127.0.0.1",
"data" : [ {
"field" : "1111",
"value" : "John Smith"
}, {
"field" : "2222",
"value" : "Apple"
} ]
}, {
"id" : "1001",
"timestamp" : "2007-02-02 02:02:02",
"user_agent" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)",
"remote_addr" : "127.0.0.1",
"data" : [ {
"field" : "1111",
"value" : "Jane Smith"
}, {
"field" : "2222",
"value" : "Banana"
} ]
} ],
"total" : 2,
"pages" : 1
}
}

Example PHP Response

a:2:{s:6:"status";s:2:"ok";s:8:"response";a:3:{s:11:"submissions";a:2:{i:0;a:5:{s:2:"id";s:4:"1001";s:9:"timestamp";s:19:"2007-01-01 01:01:01";s:10:"user_agent";s:50:"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)";s:11:"remote_addr";s:9:"127.0.0.1";s:4:"data";a:2:{i:0;a:2:{s:5:"field";s:4:"1111";s:5:"value";s:10:"John Smith";}i:1;a:2:{s:5:"field";s:4:"2222";s:5:"value";s:5:"Apple";}}}i:1;a:5:{s:2:"id";s:4:"1001";s:9:"timestamp";s:19:"2007-02-02 02:02:02";s:10:"user_agent";s:50:"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)";s:11:"remote_addr";s:9:"127.0.0.1";s:4:"data";a:2:{i:0;a:2:{s:5:"field";s:4:"1111";s:5:"value";s:10:"Jane Smith";}i:1;a:2:{s:5:"field";s:4:"2222";s:5:"value";s:6:"Banana";}}}}s:5:"total";i:2;s:5:"pages";i:1;}}

This page was: Helpful | Not Helpful