Sidebar Menu

GetMediaInfo

Retrieve info of a particular media file that was added to your SMS Notify! license key.

Endpoint

POST (HTTP): https://messaging.cdyne.com/Messaging.svc/GetMediaInfo

Syntax

GetMediaInfo(Request)

Request Parameters

Parameter Name Description Data Type Required Sample Value
EndDate

Most recent UTC date and time media was added to license key.

DateTime False 2020-05-31T11:20:00
FileType

File type of media.

String False .jpg
FilenamePattern

Name of media file.

String FALSE (If MediaID is provided.) Monkey.jpg
IncomingMessageID

Unique ID associated to incoming message with media file.

GUID False 1627aea5-8e0a-4371-9022-9b504344e724
LicenseKey

License key associated with media file.

GUID True f01d89fd-5155-5455-5585-e84ab8de8591
MaximumFileSize

Largest file size of media.

Int False 97465
MediaId

Unique ID for specific media file.

Int 12487
OutgoingMessageID

Unique ID associated to outgoing message with media file.

GUID False 1627aea5-8e0a-4371-9022-9b504344e724
PageNumber

Page number where media file is stored.

Int False 0
PageSize

Number of media files per page.

Int False 0
StartDate

Earliest UTC date and time media was added to license key.

DateTime False 2020-05-31T11:20:00
Tag

Category of media file.

String False Monkey

Response

Returns: GetMediaInfoResponse object

Code Samples

// https://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GetMediaInfo.WSDL;

namespace GetMediaInfo
{
    class Program
    {
        static void Main(string[] args)
        {
            MessagingClient client = new MessagingClient("mms2wsHttpBinding");
            MediaCriteria req = new MediaCriteria();

            req.EndDate = new DateTime(2017, 10, 05, 23, 00, 0).ToUniversalTime();
            req.FileType = ".jpg";
            req.FilenamePattern = "monkey.jpg";
            req.IncomingMessageId = new Guid();
            req.LicenseKey = new Guid("f01d89fd-5155-5455-5585-e84ab8de8591");
            req.MaximumFileSize = 97465;
            req.MediaId = 0001;
            req.MinimumFileSize = 0;
            req.OutgoingMessageId = new Guid();
            req.PageNumber = 0;
            req.PageSize = 0;
            req.StartDate = new DateTime(2017, 10, 01, 14, 15, 0).ToUniversalTime();
            req.Tags = new string[] { "Monkey" };

            MediaReply resp = client.GetMediaInfo(req);

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

                if (item.Tags != null)
                {
                    foreach (var media in item.Tags)
                    {
                        Console.WriteLine("Tags: " + media + Environment.NewLine + Environment.NewLine);
                    }
                }
            }
        }
    }
}
' https://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL

Imports GetMediaInfo.WSDL

Module Module1

    Sub Main()

        Dim client As WSDL.MessagingClient = New MessagingClient("mms2wsHttpBinding")
        Dim req As New WSDL.MediaCriteria()

        req.EndDate = New DateTime(2017, 10, 5, 23, 0, 0).ToUniversalTime()
        req.FileType = ".jpg"
        req.FilenamePattern = "Monkey33.jpg"
        req.IncomingMessageId = New Guid()
        req.LicenseKey = New Guid("f01d89fd-5155-5455-5585-e84ab8de8591")
        req.MaximumFileSize = 97465
        req.MediaId = 12242
        req.MinimumFileSize = 0
        req.OutgoingMessageId = New Guid()
        req.PageNumber = 0
        req.PageSize = 0
        req.StartDate = New DateTime(2017, 10, 1, 14, 15, 0).ToUniversalTime()
        req.Tags = New String() {"Monkey"}

        Dim resp As MediaReply = client.GetMediaInfo(req)

        For Each item In resp.Media
            Console.WriteLine(
                "File Date: " + Convert.ToString(item.FileDate) + Environment.NewLine +
                "FileName: " + item.FileName + Environment.NewLine +
                "File Size: " + item.FileName + Environment.NewLine +
                "Media ID: " + Convert.ToString(item.MediaId) + Environment.NewLine +
                "Media Type: " + item.MimeType
            )

            For Each tag In item.Tags
                If item.Tags.Length > 0 Then
                    Console.WriteLine("Tags: " + tag + Environment.NewLine + Environment.NewLine)
                End If
            Next
        Next

        Console.ReadLine()

    End Sub

End Module
Dim cXML
cXML = "<MediaCriteria xmlns=""http://sms2.cdyne.com"">" & _
  "<EndDate>2017-10-20T11:20:00</EndDate>" & _
  "<FileType>.jpg</FileType>" & _
  "<FilenamePattern>monkey1.jpg</FilenamePattern>" & _
  "<LicenseKey>f01d89fd-5155-5455-5585-e84ab8de8591</LicenseKey>" & _
  "<MaximumFileSize>97465</MaximumFileSize>" & _
  "<MediaId>11777</MediaId>" & _
  "<MinimumFileSize>0</MinimumFileSize>" & _
  "<PageNumber>0</PageNumber>" & _
  "<PageSize>0</PageSize>" & _
  "<StartDate>2017-10-01T11:20:00</StartDate>" & _
  "<Tags>" & _
    "<string xmlns=""http://schemas.microsoft.com/2003/10/Serialization/Arrays"">Monkey</string>" & _
  "</Tags>" & _
"</MediaCriteria>"

Dim oXMLHTTP
Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
Set oDoc = CreateObject("MSXML2.DOMDocument")
Call oXMLHttp.Open("POST", "https://messaging.cdyne.com/Messaging.svc/GetMediaInfo", False)
Call oXMLHttp.setRequestHeader("Content-Type", "text/xml")
Call oXMLHttp.send(cXML)

MsgBox oXMLHTTP.responseText
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fso, MyFile, FileName, TextLine
Set fso = CreateObject("Scripting.FileSystemObject")
FileName = "c:\Users\Desktop\MMS.txt"

Set MyFile = fso.OpenTextFile(FileName, ForWriting, True)
MyFile.WriteLine oXMLHttp.responseText
MyFile.Close

Set MyFile = fso.OpenTextFile(FileName, ForReading)
Do While MyFile.AtEndOfStream <> True
  TextLine = MyFile.ReadLine
Loop
MyFile.Close

set request = nothing
<?php

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

$url = 'https://messaging.cdyne.com/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("\n\n\n\n");
print_r($array);

?>
require 'uri'
require 'net/http'

url = URI("https://messaging.cdyne.com/Messaging.svc/GetMediaInfo")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'

request.body = '{
"EndDate":"\/Date(1571954141000+0000)\/",
"FileType":".jpg",
"FilenamePattern":"monkey1.jpg",
"LicenseKey": "f01d89fd-5155-5455-5585-e84ab8de8591",
"MaximumFileSize": 97465,
"MediaId": 11777,
"MinimumFileSize":0,
"PageNumber": 0,
"PageSize":0,
"StartDate":"\/Date(1507040885700+0000)\/",
"Tags":["Monkey"]}'

response = http.request(request)

puts response.read_body
gets response.read_body
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.cdyne.com/Messaging.svc/GetMediaInfo");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();

        StringBuilder sb = new StringBuilder("<MediaCriteria xmlns=\"http://sms2.cdyne.com\">");
        sb.append("<EndDate>2017-10-20T11:20:00</EndDate>");
        sb.append("<FileType>.jpg</FileType>");
        sb.append("<FilenamePattern>monkey1.jpg</FilenamePattern>");
        sb.append("<LicenseKey>f01d89fd-5155-5455-5585-e84ab8de8591</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);
    }
}
{
  "EndDate":"\/Date(1506716393060+0000)\/",
  "FileType":".jpg",
  "FilenamePattern":"monkey.jpg",
  "IncomingMessageId": {{$guid}},
  "LicenseKey": "f01d89fd-5155-5455-5585-e84ab8de8591",
  "MaximumFileSize": 97465,
  "MediaId":0001,
  "MinimumFileSize":0,
  "OutgoingMessageId": {{$guid}},
  "PageNumber": 0,
  "PageSize":0,
  "StartDate":"\/Date(1506716393060+0000)\/",
  "Tags":["Monkey"]
}