CreateMediaFromContent

From CDYNE Wiki
Revision as of 13:42, 12 October 2017 by imported>Bdriggers (→‎C#)
Jump to navigation Jump to search

JSON

{
	"Base64EncodedContent":"aa/9j/4AAQSkZJRgABAQAAAQABAAD/2Q==",
	"Filename":"monkey.jpg",
	"LicenseKey":"f01d89fd-5155-5455-5585-e84ab8de8591",
	"Tags":["Monkey"]
}

C#

/*http://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 CreateMediaFromContent.WSDL;

namespace CreateMediaFromContent {

   class Program
   {
       static void Main(string[] args)
       {
           MessagingClient client = new MessagingClient("mms2wsHttpBinding");
           CreateMediaContentRequest req = new CreateMediaContentRequest();
           req.Base64EncodedContent = "aa/9j/4AAQSkZJRgABAQAAAQABAAD/2Q==";
           req.Filename = "Monkey14.jpg";
           req.LicenseKey = new Guid("f01d89fd-5155-5455-5585-e84ab8de8591");
           req.Tags = new string[] {"Monkey"};
           MediaMetadata resp = client.CreateMediaFromContent(req);
           Console.WriteLine("UTC File Date: " + resp.FileDate + Environment.NewLine +
               "File Name: " + resp.FileName + Environment.NewLine +
               "File Size: " + resp.FileSize + Environment.NewLine +
               "Media ID: " + resp.MediaId + Environment.NewLine +
               "Mime Type: " + resp.MimeType);
           foreach (var item in resp.Tags)
           {
               Console.Write("{0}", "Tags: " + item + Environment.NewLine + Environment.NewLine);
           }
           Console.ReadLine();
       }
   }

}

VB.Net

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

Imports CreateMediaFromContent.WSDL

Module Module1

   Sub Main()
       Dim client As WSDL.MessagingClient = New MessagingClient("mms2wsHttpBinding")
       Dim req As New WSDL.CreateMediaContentRequest()
       req.Base64EncodedContent = "aa/9j/4AAQSkZJRgABAQAAAQABAAD/2Q=="
       req.Filename = "VBNetMonkey.jpg"
       req.LicenseKey = New Guid("f01d89fd-5155-5455-5585-e84ab8de8591")
       req.Tags = New String() {"Monkey"}
       Dim resp As WSDL.MediaMetadata = client.CreateMediaFromContent(req)
       Console.WriteLine("UTC File Date: " + Convert.ToString(resp.FileDate) + Environment.NewLine +
                         "File Name: " + resp.FileName + Environment.NewLine +
                         "File Size: " + Convert.ToString(resp.FileSize) + Environment.NewLine +
                         "Media ID: " + Convert.ToString(resp.MediaId) + Environment.NewLine +
                         "Mime Type: " + resp.MimeType)
       For Each item In resp.Tags
           Console.WriteLine("Tags: " + item + Environment.NewLine + Environment.NewLine)
       Next
       Console.ReadLine()
   End Sub

End Module