My account : API documentation

API documentation

Account

/campaign_hg/submit_file_proof/<campaign_id> POST

Submit worker's file proof.

Parameters:

<campaign_id>

Campaign ID

Example values: e7162dd17b83

POST data

 

 

user_id

Worker's ID

ip

Worker's IP address

proof[]

Proofs submitted by Worker

file_proof_1

File proof #1

file_proof_2

File proof #2

file_proof_3

File proof #3

random_key

Random Key

Return values:

SUCCESS

status=SUCCESS, campaign_id=[campaign id], task_id=[task id]

ERROR

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

*[NO SUCH CAMPAIGN|UNKNOWN WORKER|SYSTEM ERROR|INPUT_DATA|Account has been restricted from doing any jobs.|Worker must validate phone number before doing any jobs.|This job is currently not running.|Proof is required.|Targetted campaign cannot be accepted by this user.|User's IP isn't in any of accepted countries.|User's country is in excluded countries list.|User's IP is not in accepted country.|Worker's success rate is to low.|Worker already submitted this task.|Worker with same IP already submitted this task.|VCODE is incorrect.|IP address does not match.|File format is not supported|File has a virus|File upload failure]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X POST https://api.microworkers.com/campaign_hg/submit_file_proof/<campaign_id> -F "proof[]=<proof>" -F "proof[]=<another proof>" -F "ip=<ip>" -F "user_id=<user_id>" -F "file_proof_1=@<file_proof>" -F "file_proof_2=@<file_proof>" -F "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_file_proof/e7162dd17b83");
$client->setMethod("POST");

$client->setData(
  array('proof[]' => 'task complete', 'random_key' => '123456789', 'ip' => '217.77.222.221', 'user_id' => '123456', 'file_proof_1' => new CURLFile('test.csv'))
);

$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/submit_file_proof/e7162dd17b83', {'proof[]' => 'task complete', 'random_key' => '12456678', 'ip' => '217.77.222.221', 'user_id' => '123456', 'file_proof_1' => {'file' => 'test.csv'}});
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/submit_file_proof/e7162dd17b83', {'proof[]': 'task complete', 'ip': '217.77.222.221','random_key': '1234534', 'user_id': '123456'},{'file_proof_1': open("test.csv", 'rb')})
pprint(res)

Examples:

Output (Success):

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

Output (Error):

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