Blog - API

API documentation

API documentation

Account

/campaign_b/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_b/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_b/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_b/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_b/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_b/get_worker_tasks/123456789_12345");
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

https://api.microworkers.com/campaign_b/get_worker_tasks/123456789_12345

{
  "status": "SUCCESS",
  "count": 1,
  "tasks": [
    {
      "bonus_worker_earned": "0.00000",
      "campaign_id": "123456789",
      "csv_record_nr": "0",
      "employer_comment": "",
      "file_proof": {
        "file_proof_details": [
        {
          "content_type": "image/png",
          "filename": "123456789_12345_1000.png",
          "size": 3118
        }
      ],
      "status": "SUCCESS"
    },
    "finished_datetime": "2014-12-04 11:35:17",
    "ip": "123.13.15.15",
    "proof": "",
    "task_id": "1000",
    "task_rating": "NOTRATED",
    "worker_earned": "0.00000",
    "worker_id": "12345"
  } ]
}

Output (Error):

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

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