My account : API documentation

API documentation

Account

/message/delete/<message_id> PUT

Move message to trash.

Parameters:

message_id

Message ID

Return values:

SUCCESS

status=SUCCESS, message_id=[message id]

ERROR

status=ERROR, error=[error message*]

*[NO SUCH MESSAGE|UNABLE TO DELETE MESSAGE]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X PUT https://api.microworkers.com/message/delete/<message_id> -d ""

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 . "/message/delete/c5237707dcf7");
$client->setMethod("PUT");
$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('PUT', '/message/delete/c5237707dcf7');
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('PUT', '/message/delete/c5237707dcf7')
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();
    string body = MW_API_Client.putRequest("/message/delete/c5237707dcf7", postData);
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

{
  "status": "SUCCESS",
  "message_id": "c5237707dcf7"
}

Output (Error):

{
  "status": "ERROR",
  "message_id": "c5237707dcf7"
  "error": "NO SUCH MESSAGE"
}