My account : API documentation

API documentation

Account

/campaign_b/zones_list GET

Zones list.

Parameters:

none

 

 

Return values:

SUCCESS

status=SUCCESS, count=[nr of zones], zones=[array of fields]

ERROR

status=ERROR, error=[error message*]

*[NO ZONES]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X GET https://api.microworkers.com/campaign_b/zones_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 . "/campaign_b/zones_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', '/campaign_b/zones_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', '/campaign_b/zones_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("/campaign_b/zones_list");
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

https://api.microworkers.com/campaign_b/zones_list

{
  "status": "SUCCESS",
  "count": 3,
  "zones": [
    {
      "countries": [
        {
          "code": "ai",
          "name": "Anguilla"
        },
        {
          "code": "ag",
          "name": "Antigua and Barbuda"
        },
        {
          "code": "ve",
          "name": "Venezuela"
        }
      ],
      "id": "caribbean1",
      "name": "Caribbean"
    },
    {
      "countries": [
        {
          "code": "ph",
          "name": "Philippines"
        },
        {
          "code": "pl",
          "name": "Poland"
        },
        {
          "code": "au",
          "name": "Australia"
        },
        {
          "code": "de",
          "name": "Germany"
        },
        {
          "code": "fr",
          "name": "France"
        },
        {
          "code": "lk",
          "name": "Sri Lanka"
        },
        {
          "code": "mk",
          "name": "Macedonia"
        }
      ],
      "id": "int",
      "name": "International"
    },
    {
      "countries": [
        {
          "code": "us",
          "name": "United States"
        },
        {
          "code": "uk",
          "name": "United Kingdom"
        },
        {
          "code": "ca",
          "name": "Canada"
        },
        {
          "code": "au",
          "name": "Australia"
        },
        {
          "code": "nz",
          "name": "New Zealand"
        }
      ]
      "id": "west1",
      "name": "USA - Western"
    }
  ]
}

Output (Error):

https://api.microworkers.com/campaigns_b/list_extend

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