ipOne API Documentation


survey/submit_assignmnt

Receives a completed assignment

Important:  An API Key is required to work with these API Calls

Important:  This API Call requires information to be sent in via POST

Unscheduled Assignment Option:  If submitting an unscheduled Assignment, set assignment_id to 'new'

Sample Request (Use test form to submit)

http://api.verifiapp.com/survey/submit_assignment/{API-KEY}/{ASSIGNMENT-ID}

Normal / Scheduled Assignment : A JSON formatted array needs to be Posted to the API function. For example:

$survey_answers = array(
  "assignment_id" => "1",
  "api_key" => "4de89f5841",
  "survey_id" => "4",
  "survey_started_datetime" => "2011-06-01 14:03:22",
  "survey_ended_datetime" => "2011-06-01 14:53:22",
  "survey_started_gps" => "51.89722, -8.47",
  "survey_ended_gps" => "51.89722, -8.47",
  "completion_code_id" => "1",
  "survey_location" => "Cork,Ireland",
  "photos" => "88tq79sozludtwaa.jpg,s71owww7bhc25kbh.jpg",
  "videos" => "811119sozludtwaa.mp4,s71owabcbhc25kbh.mp4",

  "survey_answers" => array(
            0 => array("question_id" => "10", "answer" => "a sample answer, etc etc etc", "comments" => ""),
            1 => array("question_id" => "11", "answer" => "a another sample answer, etc etc etc", "comments" => ""),
            2 => array("question_id" => "12", "answer" => "a another sample answer, etc etc etc", "comments" => ""),
            3 => array("question_id" => "13", "answer" => "a another sample answer, etc etc etc", "comments" => ""),
            4 => array("question_id" => "14", "answer" => "a another sample answer, etc etc etc", "comments" => "")
)
);

Un-scheduled Assignment : A JSON formatted array needs to be Posted to the API function. For example:

$survey_answers = array(
  "assignment_id" => "-1",
  "client" => "Joe Bloggs",
  "project" => "Project 55",
  "job_type" => "Normal",
  "location" => "Cork City Centre",
  "api_key" => "4de89f5841",
  "survey_id" => "4",
  "survey_started_datetime" => "2011-06-01 14:03:22",
  "survey_ended_datetime" => "2011-06-01 14:53:22",
  "survey_started_gps" => "51.89722, -8.47",
  "survey_ended_gps" => "51.89722, -8.47",
  "completion_code_id" => "1",
  "survey_location" => "Cork,Ireland",
  "photos" => "88tq79sozludtwaa.jpg,s71owww7bhc25kbh.jpg",
  "videos" => "811119sozludtwaa.mp4,s71owabcbhc25kbh.mp4",

  "survey_answers" => array(
            0 => array("question_id" => "10", "answer" => "a sample answer, etc etc etc", "comments" => ""),
            1 => array("question_id" => "11", "answer" => "a another sample answer, etc etc etc", "comments" => ""),
            2 => array("question_id" => "12", "answer" => "a another sample answer, etc etc etc", "comments" => ""),
            3 => array("question_id" => "13", "answer" => "a another sample answer, etc etc etc", "comments" => ""),
            4 => array("question_id" => "14", "answer" => "a another sample answer, etc etc etc", "comments" => "")
)
);

Sample Successful Response

{result: "success", results: "Assignment 1 completed with 10 answers saved successfully"}

Important:  This function currently allows assignments to be answered more than once

Successful Response Reference

A successful response will return the following items in a JSON array

Preference Description Default value Notes
result success    
results The assignment ID that has been completed and the number of questions saved    
assignment_id The assignment ID that has been completed. From the survey_assignments table and in raw integer number    

Unsuccessful Response Reference

A unsuccessful response will return the following items in a JSON array

Preference Description Sample response
result error  
error The specific error is described in the response