Blog - API

API documentation

API documentation

Account

/campaigns_b/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_b/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_b/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_b/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_b/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_b/list_extend?status=RUNNING");
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

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

{
  "status": "SUCCESS",
  "campaigns":[
  {
    "available_positions": "30",
    "campaign_id": "471309053a30",
    "campaign_status": "RUNNING",
    "title": "Youtube video",
    "created_datetime9": "2014-11-21 15:06:16",
    "excluded_countries": "",
    "payment_per_task": "0.11000",
    "speed": "1000",
    "status": "SUCCESS",
    "targeted_countries": "INT",
    "tasks_nok": "0",
    "tasks_not_rated": "1",
    "tasks_not_reviewed": "0",
    "tasks_ok": "1"
  },
  {
    "available_positions": "30",
    "campaign_id": "93fd277c36b0",
    "campaign_status": "BLOCKED",
    "title": "Google Search",
    "created_datetime9": "2014-11-23 10:32:35",
    "excluded_countries": "",
    "payment_per_task": "0.11000",
    "speed": "1000",
    "status": "SUCCESS",
    "targeted_countries": "INT",
    "tasks_nok": "0",
    "tasks_not_rated": "0",
    "tasks_not_reviewed": "0",
    "tasks_ok": "0"
  },
  {
    "available_positions": "30",
    "campaign_id": "c67256cc6388",
    "campaign_status": "RUNNING",
    "title": "Post comment",
    "created_datetime9": "2014-11-21 11:31:12",
    "excluded_countries": "",
    "payment_per_task": "0.10000",
    "speed": "1000",
    "status": "SUCCESS",
    "targeted_countries": "INT",
    "tasks_nok": "0",
    "tasks_not_rated": "0",
    "tasks_not_reviewed": "0",
    "tasks_ok": "1"
  }],
  "count": 3
}

Output (Error):

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

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