Secure Message Center (SMC) API

API change history

SEARCH THE INBOX

This method is used to search the user's inbox, based on filter parameters. A session key must be submitted via the X-Session-Key header. A successful transaction will receive a 200 status code.

Try it

Request

Request URL

Request headers

  • (optional)
    string
  • (optional)
    string
    Media type of the body sent to the API.
  • string
    Subscription key which provides access to this API. Found in your Profile.

Request body

Mailbox search options data

{
  "Filter": "string",
  "FolderId": 0,
  "GetInboxUnReadOnly": true,
  "GetRetractedMsgs": true,
  "OrderBy": "string",
  "OrderDesc": true,
  "PageNum": 0,
  "PageSize": 0
}
{
  "description": "Mailbox search options data",
  "required": [
    "PageNum",
    "PageSize"
  ],
  "type": "object",
  "properties": {
    "Filter": {
      "description": "The search criteria",
      "type": "string"
    },
    "FolderId": {
      "format": "int32",
      "description": "Unique folder identifier of the Inbox or Outbox folder to search.\r\n1 is the primary Inbox folder and is the default when searching an Inbox folder.\r\n3 is the primary Outbox folder. The FolderId is required when searching an Outbox folder.",
      "type": "integer"
    },
    "GetInboxUnReadOnly": {
      "description": "Setting this to true will only return unread messages.\r\nThe default is false.",
      "type": "boolean"
    },
    "GetRetractedMsgs": {
      "description": "Setting this to true will search retracted messages as well.\r\nThe default is false.",
      "type": "boolean"
    },
    "OrderBy": {
      "description": "Field by which to sort the result set",
      "type": "string"
    },
    "OrderDesc": {
      "description": "Order descending.\r\nThe default is false (order ascending).",
      "type": "boolean"
    },
    "PageNum": {
      "format": "int32",
      "description": "Page number to return",
      "type": "integer"
    },
    "PageSize": {
      "format": "int32",
      "description": "Number of records returned per page",
      "type": "integer"
    }
  }
}

Responses

200 OK

Ok

Representations

{
  "PageDetails": {
    "CurrentPage": 0,
    "FolderId": 0,
    "OrderBy": "string",
    "PageSize": 0,
    "TotalMessages": 0,
    "TotalPages": 0
  },
  "Results": [
    {
      "CreateTime": "string",
      "LastAction": 0,
      "MessageId": 0,
      "MessageSize": 0,
      "MessageStatusId": 0,
      "PasswordHint": "string",
      "Read": true,
      "MessageStatus": 0,
      "ReadConfirmation": true,
      "SenderEmail": "string",
      "SenderId": 0,
      "Subject": "string"
    }
  ]
}
{
  "description": "The inbox search result data",
  "required": [
    "PageDetails",
    "Results"
  ],
  "type": "object",
  "properties": {
    "PageDetails": {
      "description": "Search result page details data structure",
      "required": [
        "CurrentPage",
        "FolderId",
        "OrderBy",
        "PageSize",
        "TotalMessages",
        "TotalPages"
      ],
      "type": "object",
      "properties": {
        "CurrentPage": {
          "format": "int32",
          "description": "The current page number of all records returned",
          "type": "integer"
        },
        "FolderId": {
          "format": "int32",
          "description": "Unique identifier of folder being searched",
          "type": "integer"
        },
        "OrderBy": {
          "description": "Sort column applied to the dataset",
          "type": "string"
        },
        "PageSize": {
          "format": "int32",
          "description": "Number of records returned per page",
          "type": "integer"
        },
        "TotalMessages": {
          "format": "int32",
          "description": "Total number of records found",
          "type": "integer"
        },
        "TotalPages": {
          "format": "int32",
          "description": "Total number of pages defined by PageSize",
          "type": "integer"
        }
      }
    },
    "Results": {
      "description": "Inbox search result data collection structure",
      "type": "array",
      "items": {
        "description": "Inbox search result item data",
        "required": [
          "CreateTime",
          "LastAction",
          "MessageId",
          "MessageSize",
          "MessageStatusId",
          "PasswordHint",
          "Read",
          "MessageStatus",
          "ReadConfirmation",
          "SenderEmail",
          "SenderId",
          "Subject"
        ],
        "type": "object",
        "properties": {
          "CreateTime": {
            "description": "Date/time the message was created",
            "type": "string"
          },
          "LastAction": {
            "format": "int32",
            "description": "Last action taken by user: [0(None), 1(Replied), 2(Forwarded)]",
            "enum": [
              0,
              1,
              2
            ],
            "type": "integer"
          },
          "MessageId": {
            "format": "int32",
            "description": "Unique message identifier",
            "type": "integer"
          },
          "MessageSize": {
            "format": "int64",
            "description": "Total size (bytes) of messages contained in folder",
            "type": "integer"
          },
          "MessageStatusId": {
            "format": "int32",
            "description": "The message status ID",
            "type": "integer"
          },
          "PasswordHint": {
            "description": "Hint in the form of a question that the recipient has to answer in order to access the message",
            "type": "string"
          },
          "Read": {
            "description": "Indicates whether or not the message was opened",
            "type": "boolean"
          },
          "MessageStatus": {
            "format": "int32",
            "description": "Integer referring to status of message.\r\nSender-Only Status Types:\r\n[-8(DirectMessageFailed), -7(PendingUpload), -6(PendingLicense), -5(Pending), -4(Restricted), -3(Deleted), -2(Retracted), -1(Draft), 0(EditMode)]\r\nSender/Recipient Status Types:\r\n[1(NoticeInQueue), 2(NoticeSent)]\r\nPer Recipient (not per message) Status Types:\r\n[3(UnRead), 4(Read)]\r\nPush Status Types:\r\n[5(SentSafeTls), 6(NoticeError), 7(Pop3Delivered), 8(PushedZip), 10(PushedPdf)]\r\nSecureForms Status Types:\r\n[11(DistributionRequestProcessed), 12(DistributionRequestFailed)]\r\nDataBridge Status Types:\r\n[13(WorkflowDestinationEnroute), 14(WorkflowDestinationDelivered), 15(WorkflowDestinationUnreachable)]\r\nDataMotion Direct Status Types:\r\n[16(DirectMessageQueued), 17(DirectMessageSent), 18(DirectMessageDispatched), 19(DirectMessageProcessed)]",
            "enum": [
              0,
              1,
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              10,
              11,
              12,
              13,
              14,
              15,
              16,
              17,
              18,
              19,
              -8,
              -7,
              -6,
              -5,
              -4,
              -3,
              -2,
              -1
            ],
            "type": "integer"
          },
          "ReadConfirmation": {
            "description": "In a plain text delivery environment, this indicator forces the recipient to access the web interface to retrieve a message, so the sender receives absolute read confirmation and detailed tracking information",
            "type": "boolean"
          },
          "SenderEmail": {
            "description": "Sender's email address",
            "type": "string"
          },
          "SenderId": {
            "format": "int32",
            "description": "Unique user identifier for the sender",
            "type": "integer"
          },
          "Subject": {
            "description": "Subject line of the message",
            "type": "string"
          }
        }
      }
    }
  }
}

400 Bad Request

The MailboxSearchOptionsData model is required in the request body. || The PageNum field is required. || The PageSize field is required.

Representations

401 Unauthorized

The X-Session-Key header is missing. || Bad session key. || Session key expired. || User is not authorized to use the Web Service API. || FolderId [FolderId] not found. || FolderId [FolderId] is not an inbox folder. || Please specify a page size between 1 and 1000. || Expected 2 tables from WSGetInboxData but got [NumberOfTables]. || Last action [LastAction] is not supported.

Representations

Code samples

@ECHO OFF

curl -v -X POST "https://api.datamotion.com/SecureMail-Sandbox/Message/Inbox/Search"
-H "X-Session-Key: "
-H "Content-Type: application/json"
-H "Ocp-Apim-Subscription-Key: {subscription key}"

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("X-Session-Key", "");
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");

            var uri = "https://api.datamotion.com/SecureMail-Sandbox/Message/Inbox/Search?" + queryString;

            HttpResponseMessage response;

            // Request body
            byte[] byteData = Encoding.UTF8.GetBytes("{body}");

            using (var content = new ByteArrayContent(byteData))
            {
               content.Headers.ContentType = new MediaTypeHeaderValue("< your content type, i.e. application/json >");
               response = await client.PostAsync(uri, content);
            }

        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://api.datamotion.com/SecureMail-Sandbox/Message/Inbox/Search");


            URI uri = builder.build();
            HttpPost request = new HttpPost(uri);
            request.setHeader("X-Session-Key", "");
            request.setHeader("Content-Type", "application/json");
            request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
        };
      
        $.ajax({
            url: "https://api.datamotion.com/SecureMail-Sandbox/Message/Inbox/Search?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("X-Session-Key","");
                xhrObj.setRequestHeader("Content-Type","application/json");
                xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
            },
            type: "POST",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://api.datamotion.com/SecureMail-Sandbox/Message/Inbox/Search";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"POST"];
    // Request headers
    [_request setValue:@"" forHTTPHeaderField:@"X-Session-Key"];
    [_request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://api.datamotion.com/SecureMail-Sandbox/Message/Inbox/Search');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'X-Session-Key' => '',
    'Content-Type' => 'application/json',
    'Ocp-Apim-Subscription-Key' => '{subscription key}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_POST);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'X-Session-Key': '',
    'Content-Type': 'application/json',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.urlencode({
})

try:
    conn = httplib.HTTPSConnection('api.datamotion.com')
    conn.request("POST", "/SecureMail-Sandbox/Message/Inbox/Search?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'X-Session-Key': '',
    'Content-Type': 'application/json',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.parse.urlencode({
})

try:
    conn = http.client.HTTPSConnection('api.datamotion.com')
    conn.request("POST", "/SecureMail-Sandbox/Message/Inbox/Search?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://api.datamotion.com/SecureMail-Sandbox/Message/Inbox/Search')


request = Net::HTTP::Post.new(uri.request_uri)
# Request headers
request['X-Session-Key'] = ''
# Request headers
request['Content-Type'] = 'application/json'
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body