Blog - API

API documentation

API documentation

Account

/worker/b_tasks GET

Returns submitted tasks list.

Parameters:

GET data

 

 

rating

(Optional) Task Rating

Example values: [OK|NOK|NOTRATED|NOTREVIEWED|REVISE]

finished_from

(Optional) Finished from datetime

Example value: 2014-12-02 00:00:00

finished_to

(Optional) Finished to datetime

Example value: 2014-12-31 23:59:59

page

(Optional) Page #

Example value: 2. Default: 1

entries_per_page

(Optional) Entries per page #

Example value: 100. Default/Max: 200

Return values:

SUCCESS

status=SUCCESS, tasks=[array of array], pager=[pagination]

ERROR

status=ERROR, error=[error message*], errors_list=[errors list]

*[INPUT_DATA]

**[Rating has invalid value|Finished From is invalid datetime|Finished To is invalid datetime|Page is invalid|Entries Per Page is invalid|Page must be bigger than zero|Entries Per Page must be bigger than zero|Entries Per Page must be less or equal to 200]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X GET "https://api.microworkers.com/worker/b_tasks?entries_per_page=2"

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 . "/worker/b_tasks");
$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', '/worker/b_tasks');
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', '/worker/b_tasks')
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("/worker/b_tasks");
    Console.WriteLine (body);
  }
}

Examples:

https://api.microworkers.com/worker/b_tasks?entries_per_page=2

{
  "status": "SUCCESS",
  "pager": {
    "current_page": 1,
    "entries_on_this_page": 2,
    "entries_per_page": 2,
    "first": 1,
    "first_page": 1,
    "last": 2,
    "last_page": 29,
    "next_page": 2,
    "previous_page": null,
    "total_entries": 57
  },
  "tasks": [
    {
      "bonus_worker_earned": "0.00000",
      "campaign_id": "69b73e89ae7c",
      "campaign_title": "Test Campaign",
      "csv_record_nr": "0",
      "employer_comment": "",
      "finished_datetime": "2015-03-11 08:54:44",
      "has_file": "0",
      "id": "18950924",
      "ip": "182.27.13.82",
      "proof": "test",
      "task_rating": "NOK",
      "worker_earned": "0.00000",
      "worker_id": "1354174c"
    },
    {
      "bonus_worker_earned": "0.00000",
      "campaign_id": "00119c2ef7af",
      "campaign_title": "Facebook like",
      "csv_record_nr": "0",
      "employer_comment": "",
      "finished_datetime": "2015-03-19 11:20:14",
      "has_file": "0",
      "id": "18950941",
      "ip": "182.27.13.82",
      "proof": "test",
      "task_rating": "NOK",
      "worker_earned": "0.00000",
      "worker_id": "1354174c"
    }
  ]
}

https://api.microworkers.com/worker/b_tasks?finished_from=123

{
  "status": "ERROR",
  "errors_list": ["Finished From is invalid datetime"],
  "error": "INPUT_DATA"
}