My account : API documentation

API documentation

Account

/employer/exclude_list POST

Add workers to exclude list.

Parameters:

POST data
worker[]

Worker's User ID

Return values:

SUCCESS

status=SUCCESS, message=NN workers have been added

ERROR

status=ERROR, error=[error message*]

*[No workers were added to exclude list]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X POST https://api.microworkers.com/employer/exclude_list -F "worker[]=<worker_id>" -F "worker[]=<worker_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 . "/employer/exclude_list");
$client->setMethod("POST");
$client->setData(
  array(
    'worker'=>["1234567","2345679"]
  )
);
$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', '/employer/exclude_list', {
  'worker[]' => ["1234567", "2345678"]
});
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', '/employer/exclude_list', {
  'worker[]': ["1234567", "2345678"]
})
pprint(res)

C#:

using System;
using MWAPI;
using System.Collections.Specialized;

public class Test
{
  public static void Main (string[] args)
  {
    MW_API MW_API_Client = new MW_API ("YOUR_API_KEY");
    NameValueCollection postData = new NameValueCollection();
    postData.Add("worker[]", "1234567");
    string body = MW_API_Client.postRequest("/employer/exclude_list", postData);
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

{
  "status": "SUCCESS",
  "message": "2 workers have been added"
}

Output (Error):

{
  "status": "ERROR",
  "error": "No workers were added to exclude list"
}