My account : API documentation

API documentation

Account

/campaign_b/new_campaign POST

Starts a new campaign.

Parameters:

POST data
title

Title

zone

Zone you want to target [asia1|caribbean1|europe1|europe2|int|west1]

selected_countries

String of countries targetted (IN CN US...)

Only applicable when "int" zone is selected

category

Category ID

minutes_to_finish

How many minutes will this job take

available_positions

Must be higher than 30

payment_per_task

Cost per task (example: 0.10, 0.13, 0.56,...)

speed

Speed of campaign (1-1000) where 1000 is fastest

required_work

Description of what is required

required_proof

Description of required proof

ttr

Time to rate in days (1-30)

auto_rate

[NO|V|V+R]

file_proof

[0|1|2] Where:

0 - Workers do not have to upload any files as proof

1 - Workers can optionally upload file as proof

2 - Workers are required to upload file as proof

file

(Optional) File as part of the Campaign

qt_required

(Optional) [0|1] Where:

0 - No

1 - Yes (Default)

Return values:

SUCCESS

status=SUCCESS, campaign_id=[campaign id], speed_previous=[x], speed_new=[y]

ERROR

status=ERROR, error=[array of error messages*], min_payment_per_task=[min payment per task]

*[NO SUCH CAMPAIGN|INCORRECT SPEED VALUE]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X POST https://api.microworkers.com/campaign_b/new_campaign -F "file=@<filename>" -F "file_proof=<file_proof>" -F "title=<title>" -F "zone=<zone>" -F "selected_countries=<selected_countries>" -F "category=<category>" -F "minutes_to_finish=<minutes_to_finish>" -F "available_positions=<available_positions>" -F "payment_per_task=<payment_per_task>" -F "speed=<speed>" -F "required_work=<required_work>" -F "required_proof=<required_proof>" -F "ttr=<ttr>" -F "auto_rate=<auto_rate>"

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/new_campaign");
$client->setMethod("POST");
$client->setData(
  array(
    "title"=>"My Website: Sign up",
    "zone"=>"int", // [asia1|caribbean1|europe1|europe2|int|west1]
    "selected_countries"=>"IN CN", // [CC1 CC2 CC3...]
    "category"=>"9900",
    "file_proof"=> 0,
    "minutes_to_finish"=>"4",
    "available_positions"=>"30",
    "payment_per_task"=>"0.10",
    "speed"=>"250",
    "required_work"=>"1. Go to www.mywebsite.com\n2. Sign up",
    "required_proof"=>"1. Paste Username here",
    "ttr"=>"3",
    "auto_rate"=>"NO"
  )
);
$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('POST', '/campaign_b/new_campaign', {
  "title" => "My Website: Sign up",
  "file_proof" => 0,
  "file" => {"file" => "job_description.xlsx"},
  "zone" => "int",
  "selected_countries" => "BD ID",
  "category" => "0500",
  "minutes_to_finish" => "3",
  "available_positions" => "30",
  "payment_per_task" => "0.11",
  "speed" => "1000",
  "required_work" => "1. Go to www.mywebsite.com\n2. Sign up",
  "required_proof" => "1. Paste Username here",
  "ttr" => "7",
  "auto_rate" => "NO"
});
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('POST', '/campaign_b/new_campaign', {
  "title": "My Website: Sign up",
  "file_proof": 0,
  "zone": "int",
  "selected_countries": "BD ID",
  "category": "0500",
  "minutes_to_finish": "3",
  "available_positions": "30",
  "payment_per_task": "0.11",
  "speed": "1000",
  "required_work": "1. Go to www.mywebsite.com\n2. Sign up",
  "required_proof": "1. Paste Username here",
  "ttr": "7",
  "auto_rate": "NO"
},{'file': open("job_description.xlsx", 'rb')})
pprint(res)

C#:

using System;
using MWAPI;
using System.Collections.Specialized;

public class Test
{
  public static void Main (string[] args)
  {
    MW_API MW_API_Client = new MW_API ("YOUR_API_KEY");
    NameValueCollection postData = new NameValueCollection();
    postData.Add("title", "My Website: Sign up");
    postData.Add("file_proof", "0");
    postData.Add("zone", "int");
    postData.Add("selected_countries", "BD ID");
    postData.Add("category", "0500");
    postData.Add("minutes_to_finish", "3");
    postData.Add("available_positions", "30");
    postData.Add("payment_per_task", "0.11");
    postData.Add("speed", "1000");
    postData.Add("required_work", "1. Go to www.mywebsite.com\n2. Sign up");
    postData.Add("required_proof", "1. Paste Username here");
    postData.Add("ttr", "7");
    postData.Add("auto_rate", "NO");
    string body = MW_API_Client.postRequest("/campaign_b/new_campaign", postData);
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

{
  "status": "SUCCESS",
  "campaign_id": "86f343b74104",
  "cost": 3.975
}

Output (Error):

{
  "status": "ERROR",
  "errors": [
    "POSITIONS",
    "AUTO RATE"
  ],
  "min_payment_per_task": 0.08
}