Reading Microtasks
After receiving a callback notification you can use the API to read the results of the work completed on your microtask.
To list all of your Microtasks, you can make a GET request to the '/api/task' endpoint. This will return every Microtask in the current bucket. Up to 50 results will be returned at a time. To get subsequent pages of results, you can make a GET request using the 'next' URL listed in the previous response.
$response = HTTP_Request('https://www.t4sk.dev/api/task', $api_token);
Example response:
{ [data] => Array ( [0] => stdClass Object ( [id] => 1234 [is_html] => 1 [title] => My First Task [priority] => 1 [type] => 'multi' [question] => ... [answers] => ... [num_answers] => 1 [num_entered] => 0 [can_super] => 1 [completed_at] => 2020-03-19 20:04:50 [final_answer] => 1 [passthrough_data] => ... [created_at] => 2020-05-06T17:12:47.000000Z ) ... [49] => stdClass Object ( [id] => 1235 [is_html] => 0 [title] => My 50th Task [priority] => 50 [type] => 'fill' [question] => ... [answers] => ... [num_answers] => 2 [num_entered] => 1 [can_super] => 0 [completed_at] => null [final_answer] => ... [passthrough_data] => ... [created_at] => 2020-05-07T17:12:47.000000Z ) ) [links] => stdClass Object ( [first] => https://www.t4sk.dev/api/task?page=1 [last] => https://www.t4sk.dev/api/task?page=17 [prev] => [next] => https://www.t4sk.dev/api/task?page=2 ) [meta] => stdClass Object ( [current_page] => 1 [from] => 1 [last_page] => 17 [path] => https://www.t4sk.dev/api/task [per_page] => 50 [to] => 50 [total] => 846 ) }
You can also list a single Microtask if you know its ID number. If the ID number was 1234, you would make a GET request to '/api/task/1234'.
$response = HTTP_Request('https://www.t4sk.dev/api/task/1234', $api_token);
Example response:
{ [data] => stdClass Object ( [id] => 1234 [is_html] => 1 [title] => My First Task [priority] => 1 [type] => 'multi' [question] => ... [answers] => ... [num_answers] => 2 [num_entered] => 1 [can_super] => 1 [completed_at] => ... [final_answer] => ... [passthrough_data] => ... [created_at] => 2020-05-06T17:12:47.000000Z [progress] => Array ( [0] => stdClass Object ( [name] => Jake [answer] => 1 [elapsed] => 36 ) ) ) }
The final consensus answer will be included in the 'final_answer' field if the tasks has been completed. If your task is of type "HTML Form", then instead of a single consensus answer, this will be a json encoded array of all answers recorded for this Microtask.
The 'progress' field will be included when fetching one Microtask from the API. This will be an array of all the individual pieces of work done on the task by you and your helpers.
Creating Microtasks
Updating Microtasks