This method retrieves information about your media files.

Endpoint

POST:
https://messaging.esendex.us/Messaging.svc/GetMediaInfo

Syntax

GetMediaInfo(Request)

Request Parameters

Parameter NameDescriptionData TypeRequiredSample Value
EndDateUTC date/time of newest media to retrieve.DateTimeFalse/Date(1682439497785)/
FilenamePatternName of the media.StringFalseMonkey.jpg
FileTypeFile type of the media.StringFalse.jpg
IncomingMessageIdUnique ID of the incoming message with the media.GUIDFalse1627aea5-8e0a-4371-9022-9b504344e724
LicenseKeyLicense key associated with the media.GUIDTrue00000000-0000-0000-0000-000000000000
MaximumFileSizeLargest file size of the media.LongFalse97465
MediaIdUnique ID of the media.LongFalse12345678
MinimumFileSizeSmallest file size of the media.LongFalse97465
OutgoingMessageIDUnique ID of the outgoing message with the media.GUIDFalse1627aea5-8e0a-4371-9022-9b504344e724
PageNumberNumber of the page to retrieve.IntFalse1
PageSizeNumber of media files per page.IntFalse10
StartDateUTC date/time of oldest media to retrieve.DateTimeFalse/Date(1682439497785)/
TagsCategory of the media.Array of String valuesFalseanimal

Response

Returns: MediaReply object

Code Samples

You can use any programming language you want with our API, as long as it can make a REST or SOAP call. Here are examples for some of the most common platforms.

C#

// https://messaging.esendex.us/Messaging.svc?wsdl was added as a Service Reference and given the name WSDL

using WSDL;

var client = new MessagingClient(MessagingClient.EndpointConfiguration.mms2wsHttpBindingSecure);

var criteria = new MediaCriteria
{
    LicenseKey = YOUR_LICENSE_KEY
};

var media = await client.GetMediaInfoAsync(criteria);

foreach (var m in media.Media)
{
    Console.WriteLine(
        "File Date: " + m.FileDate + Environment.NewLine +
        "File Name: " + m.FileName + Environment.NewLine +
        "File Size: " + m.FileSize + Environment.NewLine +
        "Media ID: " + m.MediaId + Environment.NewLine +
        "Media Type: " + m.MimeType);

    if (m.Tags is not null)
    {
        foreach (var tag in m.Tags)
        {
            Console.WriteLine("Tag: " + tag);
        }
    }

    Console.WriteLine(Environment.NewLine);
}

Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;

public final class GetMediaInfo {

    public static void main(String[] args) throws Exception {
        String responseContent = "";
        String response = "";

        URL url = new URL("https://messaging.esendex.us/Messaging.svc/GetMediaInfo");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();

        StringBuilder sb = new StringBuilder("<MediaCriteria xmlns="https://messaging.esendex.us">");
        sb.append("<EndDate>2017-10-20T11:20:00</EndDate>");
        sb.append("<FileType>.jpg</FileType>");
        sb.append("<FilenamePattern>monkey1.jpg</FilenamePattern>");
        sb.append("<LicenseKey>00000000-0000-0000-0000-000000000000</LicenseKey>");
        sb.append("<MaximumFileSize>97465</MaximumFileSize>");
        sb.append("<MediaId>11777</MediaId>");
        sb.append("<MinimumFileSize>0</MinimumFileSize>");
        sb.append("<PageNumber>0</PageNumber>");
        sb.append("<PageSize>0</PageSize>");
        sb.append("<StartDate>2017-10-01T11:20:00</StartDate>");
        sb.append("<Tags>");
        sb.append("<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">Monkey</string>");
        sb.append("</Tags>");
        sb.append("</MediaCriteria>");

        connection.setRequestProperty("Content-Length", String.valueOf(sb.toString().length()));
        connection.setRequestProperty("Content-Type", "text/xml");
        connection.setRequestProperty("Connection", "Close");
        connection.setRequestProperty("SoapAction", "");
        connection.setRequestMethod("POST");
        connection.setDoInput(true);
        connection.setDoOutput(true);

        PrintWriter pw = new PrintWriter(connection.getOutputStream());
        pw.write(sb.toString());
        pw.flush();
        connection.connect();
        System.out.println(sb.toString());
        BufferedReader br;

        if (connection.getResponseCode() == 200) {
            br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        } else {
            br = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
        }

        while ((responseContent = br.readLine()) != null) {
            response += responseContent;
        }
        System.out.println(response);
    }
}

JavaScript

const url = 'https://messaging.esendex.us/Messaging.svc/GetMediaInfo';
const response = await fetch(url, {
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        'LicenseKey': '00000000-0000-0000-0000-000000000000'
    }),
    method: 'POST'
});

const media = await response.json();

console.log(media);

JSON POST Request

{
	"EndDate": "/Date(928164000000-0400)/",
	"FileType": "String content",
	"FilenamePattern": "String content",
	"IncomingMessageId": "1627aea5-8e0a-4371-9022-9b504344e724",
	"LicenseKey": "1627aea5-8e0a-4371-9022-9b504344e724",
	"MaximumFileSize": 9223372036854775807,
	"MediaId": 9223372036854775807,
	"MinimumFileSize": 9223372036854775807,
	"OutgoingMessageId": "1627aea5-8e0a-4371-9022-9b504344e724",
	"PageNumber": 2147483647,
	"PageSize": 2147483647,
	"StartDate": "/Date(928164000000-0400)/",
	"Tags": [
		"String content"
	]
}

JSON Response

{
	"Media": [
		{
			"FileDate": "/Date(928164000000-0400)/",
			"FileName": "String content",
			"FileSize": 9223372036854775807,
			"MediaId": 9223372036854775807,
			"MimeType": "String content",
			"Tags": [
				"String content"
			]
		}
	]
}

PHP with cURL

<?php

$json = '{
  "EndDate":"/Date(1507040885700+0000)/",
  "FileType":".jpg",
  "FilenamePattern":"monkey1.jpg",
  "LicenseKey":"00000000-0000-0000-0000-000000000000",
  "MaximumFileSize": 97465,
  "MediaId": 11777,
  "MinimumFileSize":0,
  "PageNumber": 0,
  "PageSize":0,
  "StartDate":"/Date(1507040885700+0000)/",
  "Tags":["Monkey"]
}';

$url = 'https://messaging.esendex.us/Messaging.svc/GetMediaInfo';
$cURL = curl_init();

curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_POST, true);
curl_setopt($cURL, CURLOPT_POSTFIELDS, $json);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);

curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
// If you desire your results in XML format, use the following line for your HTTP headers and comment out the HTTP headers code line above.
// curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

$result = curl_exec($cURL);
curl_close($cURL);
$array = json_decode($result, true);

// print_r($json);
// print_r("nnnn");
print_r($array);

?>

Python

import httpx

headers = {"Accept": "application/json"}
url = "https://messaging.esendex.us/Messaging.svc/GetMediaInfo"

request = {"LicenseKey": "00000000-0000-0000-0000-000000000000"}


with httpx.Client(headers=headers) as client:
    response = client.post(url=url, json=request)

response.raise_for_status()

print(response.json())

Ruby

require 'json'
require 'net/http'

headers = { Accept: 'application/json', 'Content-Type': 'application/json' }
uri = URI('https://messaging.esendex.us/Messaging.svc/GetMediaInfo')

data = {
  'LicenseKey': '00000000-0000-0000-0000-000000000000'
}.to_json

response = Net::HTTP.post(uri, data, headers)
raise response.message if response.is_a?(Net::HTTPClientError) || response.is_a?(Net::HTTPServerError)

puts JSON.parse(response.body)

XML POST Request

<MediaCriteria xmlns="http://sms2.cdyne.com">
  <EndDate>1999-05-31T11:20:00</EndDate>
  <FileType>String content</FileType>
  <FilenamePattern>String content</FilenamePattern>
  <IncomingMessageId>1627aea5-8e0a-4371-9022-9b504344e724</IncomingMessageId>
  <LicenseKey>1627aea5-8e0a-4371-9022-9b504344e724</LicenseKey>
  <MaximumFileSize>9223372036854775807</MaximumFileSize>
  <MediaId>9223372036854775807</MediaId>
  <MinimumFileSize>9223372036854775807</MinimumFileSize>
  <OutgoingMessageId>1627aea5-8e0a-4371-9022-9b504344e724</OutgoingMessageId>
  <PageNumber>2147483647</PageNumber>
  <PageSize>2147483647</PageSize>
  <StartDate>1999-05-31T11:20:00</StartDate>
  <Tags>
    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String content</string>
    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String content</string>
  </Tags>
</MediaCriteria>

XML Response

<MediaReply xmlns="http://sms2.cdyne.com">
  <Media>
    <MediaMetadata>
      <FileDate>1999-05-31T11:20:00</FileDate>
      <FileName>String content</FileName>
      <FileSize>9223372036854775807</FileSize>
      <MediaId>9223372036854775807</MediaId>
      <MimeType>String content</MimeType>
      <Tags>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String content</string>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String content</string>
      </Tags>
    </MediaMetadata>
    <MediaMetadata>
      <FileDate>1999-05-31T11:20:00</FileDate>
      <FileName>String content</FileName>
      <FileSize>9223372036854775807</FileSize>
      <MediaId>9223372036854775807</MediaId>
      <MimeType>String content</MimeType>
      <Tags>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String content</string>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">String content</string>
      </Tags>
    </MediaMetadata>
  </Media>
</MediaReply>

Let’s get your business buzzing

Spark customer connections in minutes. Discover the full power of our mobile messaging platform—no hidden fees, just real results.