My account : API documentation

API documentation

Account

/campaign_hg/new_campaign POST

Starts a new campaign.

Parameters:

POST data

 

 

title

Title

group_id

Group ID

category

Category ID

minutes_to_finish

How many minutes will this job take

available_positions

The total number of positions (tasks) available to all participants in the campaign. available_position must be a positive integer

max_positions_per_worker

Maximum number of positions (tasks) each worker can participate in

payment_per_task

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

description_type

[SAME|UNIQUE]. If description type is SAME - all users will see same description. If it is UNIQUE, each user will have different description, with this UNIQUE option "csv" parameter is required

required_work

Description of what is required

required_proof

Users will submit required proofs after completing the task. HG campaigns support up to 3 proofs per position (task). For one required proof, please use -F "required_proof=<required_proof>", For more than one required proof, please use -F "required_proof[]=<required_proof_1>" -F "required_proof[]=<required_proof_2>"

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 files as proof

2 - Workers are required to upload files as proof

file

(Optional) File as part of the Campaign

csv

CSV file with template variables. Required for description_type = UNIQUE only, otherwise - not used

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, errors=[array of error messages*], min_payment_per_task=[min payment per task]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X POST https://api.microworkers.com/campaign_hg/new_campaign -F "file=@<filename>" -F "file_proof=<file_proof>" -F csv=@<csv> -F "group_id=<group_id>" -F "category=<category>" -F "minutes_to_finish=<minutes_to_finish>" -F "available_positions=<available_positions>" -F "max_positions_per_worker=<max_positions_per_worker>" -F "payment_per_task=<payment_per_task>" -F "title=<title>" -F "description_type=<description_type>" -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_hg/new_campaign");
$client->setMethod("POST");

$client->setData(
  array(
    "file_proof" => "0",
    "group_id" => "18f4ef1cfd73",
    "category" => "10",
    "minutes_to_finish" => "2",
    "available_positions" => "4",
    "max_positions_per_worker" => "2",
    "payment_per_task" => "0.06",
    "title" => "My Website: Sign up",
    "description_type" => "SAME",
    "required_work" => "1. Go to www.mywebsite.com\n2. Sign up",
    "required_proof" => "1. Paste Username here",
    "ttr" => "7",
    "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_hg/new_campaign', {
  "file_proof" => "0",
  "group_id" => "18f4ef1cfd73",
  "category" => "10",
  "minutes_to_finish" => "2",
  "available_positions" => "4",
  "max_positions_per_worker" => "3",
  "payment_per_task" => "0.06",
  "title" => "My Website: Sign up",
  "description_type" => "SAME",
  "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_hg/new_campaign', {
  "file_proof": "0",
  "group_id": "18f4ef1cfd73",
  "category": "10",
  "minutes_to_finish": "2",
  "available_positions": "4",
  "max_positions_per_worker": "3",
  "payment_per_task": "0.06",
  "title": "My Website: Sign up",
  "description_type": "SAME",
  "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("file_proof", "0");
    postData.Add("group_id", "18f4ef1cfd73");
    postData.Add("category", "10");
    postData.Add("minutes_to_finish", "2");
    postData.Add("available_positions", "4");
    postData.Add("max_positions_per_worker", "3");
    postData.Add("payment_per_task", "0.06");
    postData.Add("title", "My Website: Sign up");
    postData.Add("description_type", "SAME");
    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_hg/new_campaign", postData);
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

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

Output (Error):

{
  "status": "ERROR",
  "campaign_id": "86f343b74104",
  "errors": [
    "POSITIONS",
    "AUTO RATE",
  "min_payment_per_task": 0.05
  ]
}