My account : API documentation

API documentation

Account

/message/read/<message_id> GET

Returns detailed info on selected message.

Parameters:

message_id

Message ID

Example value: c5237707dcf7

Return values:

SUCCESS

status=SUCCESS, message_id, message_type, datetime=[created datetime], folder, subject, message, has_attachment=[0 - message doesn't have attached file, 1 - message has attached file]

ERROR

status=ERROR, message_id, error=[error message*]

*[NO SUCH MESSAGE]

Code:

cURL:

curl -H "MicroworkersApiKey:YOUR_API_KEY" -X GET https://api.microworkers.com/message/read/<message_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 . "/message/read/c5237707dcf7");
$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', '/message/read/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('GET', '/message/read/c5237707dcf7')
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("/message/read/c5237707dcf7");
    Console.WriteLine (body);
  }
}

Examples:

Output (Success):

https://api.microworkers.com/message/read/c5237707dcf7

{
  "status": "SUCCESS",
  "datetime": "2015-01-30 14:23:10",
  "folder": "INBOX",
  "has_attachment": "0",
  "message": "HG Campaign \"f53ebbf00237\" was declined, funds returned into account.",
  "message_id": "c5237707dcf7",
  "message_type": "",
  "subject": "HG Campaign \"f53ebbf00237\" declined"
}

Output (Error):

https://api.microworkers.com/message/read/c5237707dcf7

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