My account : API documentation

API documentation

Account

/campaign_hg/results_csv/<campaign_id> GET

Returns submitted tasks in CSV.

Parameters:

none

 

 

Return values:

SUCCESS

status=SUCCESS, campaign_id=[campaign id], csv="csv data"

ERROR

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

*[NO SUCH CAMPAIGN]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X GET https://api.microworkers.com/campaign_hg/results_csv/<campaign_id>

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/results_csv/123456789");
$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', '/campaign_hg/results_csv/123456789');
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', '/campaign_hg/results_csv/123456789')
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("/campaign_hg/results_csv/123456789");
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

https://api.microworkers.com/campaign_hg/results_csv/313687d35d31

{
  "status": "SUCCESS",
  "campaign_id": "313687d35d31",
  "csv": "CAMPAIGN_TITLE,\"Test campaign\"\nCAMPAIGN_STATUS,RUNNING\nCAMPAIGN_ID,75d093bc0dfd\nAVAILABLE_POSITIONS,10\nPAYMENT_PER_TASK,0.05000\nCREATED,\"2015-03-29 15:01:29\"\nMAX_POS_PER_WORKER,10\nGROUP,\"MW: ALL USA Workers\"\nREQUIRED_PROOFS,1\n,\nTASKS_SUBMITTED,6\nTASKS_OK,4\nTASKS_NOK,2\nTASKS_NOTRATED,0\n,\nROW,CSV_ROW,TASK_ID,USER_ID,USERNAME,TASK_RATING,FINISHED,IP,COUNTRY_CODE,PROOF_1,EMPLOYER_COMMENT,HTTP_USER_AGENT\n1,0,2208005,18f4174c,Member_12345,OK,\"2015-03-29 16:25:03\",182.217.102.84,US,mw-6ece5c1488610fd364045a7decc9321ab511139a5622b64ebd2e5558d70a1ffb,,\"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko\/20100101 Firefox\/37.0\"\n2,0,2208003,18f4174c,OK,\"2015-03-29 16:22:46\",182.217.102.84,US,mw-dd82027357748c95dec56cb4fa6b1da396157db5a30d857aa46c2d6aa25cba30,,\"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko\/20100101 Firefox\/37.0\"\n3,0,2208001,18f4174c,OK,\"2015-03-29 16:21:16\",182.217.102.84,US,mw-57bb72a755f9778f810a8da8ea6cdf00df3b88e1c5a7a0bc8ec294a561a42f74,,\"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko\/20100101 Firefox\/37.0\"\n4,0,2208000,18f4174c,OK,\"2015-03-29 16:20:42\",182.217.102.84,US,mw-c220f89b400ac2b5d6a79810fd7ac1519d14038fadb10829645856cd54bf64eb,,\"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko\/20100101 Firefox\/37.0\"\n5,0,2208004,18f4174c,NOK,\"2015-03-29 16:24:14\",182.217.102.84,US,mw-84e747cc9e10c1bf6559bca5c68d7fbc5401777395882ccc4a8cb8d501099d17,bad,\"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko\/20100101 Firefox\/37.0\"\n6,0,2208002,18f4174c,NOK,\"2015-03-29 16:22:19\",182.217.102.84,US,mw-314e60c9c6194ab8dc757cab0bc7c9d69ffbac301decf827b0b927ca2784b36d,failure,\"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko\/20100101 Firefox\/37.0\"\n"
}

Output (Error):

https://api.microworkers.com/campaign_hg/results_csv/123456780

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