Blog - API

API documentation

API documentation

Account

/campaign_hg/get_worker_tasks/<campaign_id>_<worker_id> GET

Returns worker's tasks list.

Parameters:

none

 

 

Return values:

SUCCESS

status=SUCCESS, count=[nr of tasks], tasks=[array of fields]

ERROR

status=ERROR, campaign_id, worker_id, error=[error message*]

*[NO SUCH CAMPAIGN|NO TASKS]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X GET https://api.microworkers.com/campaign_hg/get_worker_tasks/<campaign_id>_<worker_id>

PHP:

<?php

include "includes/RESTClient.php";
define("cAPI_KEY", "YOUR_API_KEY");
define("cAPI_URL", "https://api.microworkers.com");
$client = new RESTClient();
$client->setApiKey(cAPI_KEY);
$client->setUrl(cAPI_URL . "/campaign_hg/get_worker_tasks/123456789_12345");
$client->setMethod("GET");
$client->execute();
$response = $client->getLastResponse();
$client->resetClient();
echo $response;

?>

Perl:

use MW_API;
use Data::Dumper qw(Dumper);
my $mw_api = MW_API->new('api_key' => 'YOUR_API_KEY');
my $res = $mw_api->do_request('GET', '/campaign_hg/get_worker_tasks/123456789_12345');
print Dumper($res);

Python:

from pprint import pprint
from MW_API import MW_API
mw_api = MW_API('YOUR_API_KEY')
res = mw_api.do_request('GET', '/campaign_hg/get_worker_tasks/123456789_12345')
pprint(res)

C#:

using System;
using MWAPI;

public class Test
{
  public static void Main (string[] args)
  {
    MW_API MW_API_Client = new MW_API ("YOUR_API_KEY");
    string body = MW_API_Client.getRequest("/campaign_hg/get_worker_tasks/123456789_12345");
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

https://api.microworkers.com/campaign_hg/get_worker_tasks/313687d35d31_12345

{
  "status": "SUCCESS",
  "count": 1,
  "tasks": [
    {
      "bonus_worker_earned": "0.00000",
      "campaign_id": "313687d35d31",
      "csv_record_nr": "0",
      "employer_comment": "",
      "finished_datetime": "2014-11-24 10:57:25",
      "ip": "12.56.45.77",
      "proof": [
        "123",
        "",
        "",
        "",
        ""
      ],
      "task_id": "54",
      "task_rating": "NOTRATED",
      "worker_earned": "0.00000",
      "worker_id": "12345"
    }
  ]
}

Output (Error):

https://api.microworkers.com/campaign_hg/get_worker_tasks/123456780_01234

{
  "status": "ERROR",
  "campaign_id": "123456780",
  "error": "NO SUCH CAMPAIGN",
  "worker_id": "01234"
}