API documentation

API documentation

Account

/campaigns_hg/list_extend GET

Returns list of all Campaigns owned by this Employer.

Parameters:

GET data

 

 

status

(Optional) Campaign Status

Example values: [BLOCKED|PENDING_REVIEW|PENDING_RESTART| PAUSED|PAUSED_ADMIN|RUNNING|PAUSED_SYSTEM|FINISHED]

folder

(Optional) Folder

Example values: [DEFAULT|ARCHIVE]

created_from

(Optional) Created from datetime

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

created_to

(Optional) Created to datetime

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

restarted_from

(Optional) Restarted from datetime

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

restarted_to

(Optional) Restarted to datetime

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

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

Return values:

SUCCESS

status=SUCCESS, count=[nr of campaigns], campaigns=[array of array]

ERROR

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

*[NO CAMPAIGNS|INPUT_DATA]

**[Status has invalid value|Folder has invalid value|Created From is invalid datetime|Created To is invalid datetime|Restarted From is invalid datetime|Restarted To is invalid datetime|Finished From is invalid datetime|Finished To is invalid datetime]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X GET "https://api.microworkers.com/campaigns_hg/list_extend?status=RUNNING&created_from=2014-01-01 00:00:00"

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 . "/campaigns_hg/list_extend?status=RUNNING");
$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', '/campaigns_hg/list_extend?status=RUNNING');
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', '/campaigns_hg/list_extend?status=RUNNING')
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("/campaigns_hg/list_extend?status=RUNNING");
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

https://api.microworkers.com/campaigns_hg/list_extend

{
  "status": "SUCCESS",
  "campaigns": [
  {
    "available_positions": "10",
    "campaign_id": "313687d35d31",
    "campaign_status": "RUNNING",
    "title": "My Test Campaign",
    "created_datetime9": "2014-11-24 10:56:57",
    "group_of_workers_id": "18f4ef1cfd73",
    "group_of_workers_name": "MW: International Workers",
    "max_pos_per_worker": "1",
    "payment_per_task": "0.05000",
    "status": "SUCCESS",
    "tasks_nok": "0",
    "tasks_not_rated": "1",
    "tasks_not_reviewed": "0",
    "tasks_ok": "0"
  },
  {
    "available_positions": "10",
    "campaign_id": "448dfd4ab353",
    "campaign_status": "RUNNING",
    "title": "Google Search",
    "created_datetime9": "2014-11-24 10:58:21",
    "group_of_workers_id": "18f4ef1cfd73",
    "group_of_workers_name": "MW: International Workers",
    "max_pos_per_worker": "1",
    "payment_per_task": "0.06000",
    "status": "SUCCESS",
    "tasks_nok": "0",
    "tasks_not_rated": "1",
    "tasks_not_reviewed": "0",
    "tasks_ok": "0"
  },
  {
    "available_positions": "10",
    "campaign_id": "f8db2c98aca2",
    "campaign_status": "BLOCKED",
    "title": "Data Entry",
    "created_datetime9": "2014-11-21 11:34:49",
    "group_of_workers_id": "18f4ef1cfd73",
    "group_of_workers_name": "MW: International Workers",
    "max_pos_per_worker": "1",
    "payment_per_task": "0.05000",
    "status": "SUCCESS",
    "tasks_nok": "0",
    "tasks_not_rated": "0",
    "tasks_not_reviewed": "0",
    "tasks_ok": "1"
  }],
  "count": 3
}

Output (Error):

https://api.microworkers.com/campaigns_hg/list_extend

{
  "status": "ERROR",
  "error": "NO CAMPAIGNS"
}