Submit API Response
JSON Response
A request to the Query API will result in a response consisting of a JSON formatted string.
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.
JSON Decoding
Since the API response is returned in the format of a JSON string that is not easily manipulated by server-side programming languages, you’ll probably want to run it through a script that converts the JSON string into an array or object that is easier to access. To learn more about JSON, and to find out how it works with your language of choice, take a look at the JSON homepage.
Success
When a submission is successful, the JSON string will return the entry id, confirmation message, and redirect url that was specified while building the form inside of Wufoo. A successful submission will result in a JSON formatted string looking something like this:
{"wufoo_submit":[{"success":"true", "entry_id":"1025", "confirmation_message":"Success! Thanks for filling out my form!"}]}
General Error Handling
If your request to the Query API is invalid due to a general error such as the form specified does not exist, the error response will look something like this:
{"wufoo_submit":[{"success":"false", "error":"The supplied form URL was not found.", "field_errors":[]}]}.
As you can see, the “success” returns as false and the “error” reports that there was a problem with the supplied URL. To find out what the different error possibilities are, take a look at the submit API errors section.
Field Error Handling
When your data is submitted to Wufoo, the field data will be completely validated to make sure that email addresses are email addresses, numeric fields are numeric, and required fields are not blank, and so on. In the case of invalid field data, there will be “field errors” returned through the JSON string. A basic field error due to one required field that was left blank looks something like this:
{"wufoo_submit":[{"success":"false", "error":"", "field_errors":[{"field_id":"field1", "error_code":"0", "error_message":"Field is required."}]}]}
As you can see, the “success” is again false, but this time there are “field errors” present. Each field error contains an array of information including the field Id that the error pertains to, the error code caused by the field error, and the error message associated with that error code.
If there were multiple field errors, the JSON string would look similar to the last one, except there would be two items in the field_errors array and look like this:
{"wufoo_submit":[{"success":"false", "error":"", "field_errors":[{"field_id":"field0", "error_code":"2", "error_message":"Invalid email address."},{"field_id":"field1", "error_code":"0", "error_message":"Field is required."}]}]}