Blog - API

API documentation

API documentation

Account

/campaign_b/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_b/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_b/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_b/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_b/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_b/results_csv/123456789");
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

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

{
  "status": "SUCCESS",
  "campaign_id": "313687d35d31",
  "csv": "CAMPAIGN_TITLE,\"This is a test\"\nCAMPAIGN_STATUS,BLOCKED\nCAMPAIGN_ID,00119c2ef7a6\nAVAILABLE_POSITIONS,30\nPAYMENT_PER_TASK,0.10000\nCREATED,\"2009-03-18 10:54:51\"\nZONE,INT\nCOUNTRIES_TARGETED,INT\nCOUNTRIES_EXCLUDED,\n,\nTASKS_SUBMITTED,2\nTASKS_OK,2\nTASKS_NOK,0\nTASKS_NOTRATED,0\n,\nROW,TASK_ID,USER_ID,USERNAME,TASK_RATING,FINISHED,IP,COUNTRY_CODE,PROOF,EMPLOYER_COMMENT,HTTP_USER_AGENT\n1,18950935,54a37c6a,Member_123456,OK,\"2009-02-18 10:51:34\",141.201.135.239,DZ,\"1-Yahoo Username : [email protected]\",,\"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0\"\n2,18950936,54a37c6a,OK,\"2009-02-18 10:51:34\",141.201.135.239,DZ,\"1-Yahoo Username : [email protected]\",,\"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0\"\n"
}

Output (Error):

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

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