Blog - API

API documentation

API documentation

Account

/campaign_hg/submit_proof/<campaign_id> PUT

Submit worker's proof.

Parameters:

<campaign_id>

Campaign ID

Example values: e7162dd17b83

PUT data

 

 

user_id

Worker's ID

ip

Worker's IP address

random_key

Random Key

proof[]

Proofs submitted by Worker

revise_task_id

(Optional) Revise task ID. You must provide this parameter if worker submitting proof to existing task rated as REVISE

Return values:

SUCCESS

status=SUCCESS, campaign_id=[campaign id], task_id=[task id], extra_positions=[how many extra positions worker can take]

ERROR

status=ERROR, campaign_id=[campaign id], error=[error message*]

*[NO SUCH CAMPAIGN|UNKNOWN WORKER|SYSTEM ERROR|INPUT_DATA|IP address does not match.|No random key.|This task has expired. Worker did not finish it on time.|Proof is required.|VCODE is incorrect.|REVISE TASK DOES NOT EXIST]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X PUT https://api.microworkers.com/campaign_hg/submit_proof/<campaign_id> -d "proof[]=<proof>&proof[]=<another_proof>&ip=<ip>&user_id=<user_id>&random_key=<random_key>"

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/submit_proof/e7162dd17b83");
$client->setMethod("PUT");

$client->setData(
  array('proof[]' => 'task complete', 'ip' => '217.77.222.221', 'user_id' => '123456', 'random_key' => '4567890')
);

$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('PUT', '/campaign_hg/submit_proof/e7162dd17b83', {'proof[]' => 'task complete', 'ip' => '217.77.222.221', 'user_id' => '123456', 'random_key' => '4567890'});
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('PUT', '/campaign_hg/submit_proof/e7162dd17b83', {'proof': 'task complete', 'ip': '217.77.222.221', 'user_id': '123456', 'random_key': '4567890'})
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("proof[]", "task complete");
    postData.Add("ip", "217.77.222.221");
    postData.Add("user_id", "123456");
    postData.Add("random_key", "4567890");
    string body = MW_API_Client.putRequest("/campaign_hg/submit_proof/e7162dd17b83", postData);
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

{
  "status": "SUCCESS",
  "campaign_id": "a699bb9b2e7b",
  "task_id": "54321",
  "extra_positions": "0"
}

Output (Error):

{
  "status": "ERROR",
  "campaign_id": "a699bb9b2e7b",
  "error": "NO SUCH CAMPAIGN"
}