My account : API documentation

API documentation

Account

/campaigns_hg/list GET

Returns list of all Campaigns owned by this Employer, together with status.

Parameters:

none

 

 

Return values:

SUCCESS

status=SUCCESS, count=[nr of campaigns], campaigns=[array of array of (id,title,status)]

ERROR

status=ERROR, error=[error message*]

*[NO CAMPAIGNS]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X GET https://api.microworkers.com/campaigns_hg/list

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

Examples:

Output (Success):

https://api.microworkers.com/campaigns_hg/list

{
  "status": "SUCCESS",
  "count": 3,
  "campaigns": [
    [
      "007a57a00730",
      "Sign up: My Website",
      "PENDING_REVIEW"
    ],
    [
      "0385c0e1f92e",
      "Test my App",
      "RUNNING"
    ],
    [
      "095cf6b6bc3b",
      "Post on Twitter",
      "FINISHED"
    ]
  ]
}

Output (Error):

https://api.microworkers.com/campaigns_hg/list

{
  "status": "ERROR",
  "error": "NO CAMPAIGNS"
}