Blog - API

API documentation

API documentation

Account

/employer/exclude_list DELETE

Remove workers from exclude list.

Parameters:

DELETE data
worker[]

Worker's User ID or "all" if you want to remove all workers from Exclude list

 

Return values:

SUCCESS

status=SUCCESS, message=NN workers have been removed

ERROR

status=ERROR, error=[error message*]

*[workers were not found in exclude list]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X DELETE https://api.microworkers.com/employer/exclude_list -d "worker[]=<worker_id>" -d "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("DELETE");
$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('DELETE', '/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('DELETE', '/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.deleteRequest("/employer/exclude_list", postData);
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

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

Output (Error):

{
  "status": "ERROR",
  "error": "workers were not found in exclude list"
}