Authentication

If you're logged into your account you can enter REST urls into your browser to create images / download designs / use stitch player.  To integrate with web site and fullfillment process authentication will be required.

Backend Authentication

Set Authorization header to "LDWS " +  username + ":" + BytesToHex(MD5(url+LicenseKey)). 

So if your username is Bob1234 and your license key is 0123456789ABCDEF0123456780ABCDEF and url is http://api.livedesigner.com/Bob1234/GetImage/Lettering?alphabet=DIANE%20SCRIPT&text=Hello&color=ccaa00&dpi=32 Then the Authorization header would look like LDWS Bob1234:2849B1A705EC9554D78D506CC44A6447

you can get your LicenseKey from your ManageAccount page described here

Below is an example in C# demonstrating how to perform authorization on a Rest URL

private string username = "yourusername";
private string licensekey = "yourlicensekey";
public static string CalculateMD5Hash(string input)
{
    // step 1, calculate MD5 hash from input
    System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
    byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
    byte[] hash = md5.ComputeHash(inputBytes);
 
    // step 2, convert byte array to hex string
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    for (int i = 0; i < hash.Length; i++)
    {
        sb.Append(hash[i].ToString("X2"));
    }
    return sb.ToString();
}
public Byte[] GetLetteringGraphic()
{
    string url = "http://api.livedesigner.com/"+username+"/GetImage/Lettering?alphabet=DIANE%20SCRIPT&text=Hello%20World&color=ccaa00";
 
    string hash = CalculateMD5Hash(url+licensekey);
    WebClient Client = new WebClient();
    // set authorization header

    Client.Headers.Add("Authorization", "LDWS "+username+":"+hash);

    // download url   
    Byte[] lettergraphic = Client.DownloadData(url);

    return lettergraphic;
}

Ticket Authentication

if creating image urls from javascript or flash and wish to create and use urls without hitting backend then need to use ticket authentication.  Ticket Autentication only works with Image files and Stitch Player.  If wish to get design file need to use Authorization header method described above.

A)  Backend

You can Get Ticket which expires in 60 minutes from url:
 

http://api.livedesigner.com/{yourusername}/GetImageTicket?date=yymmdd

where yymmdd is the year month and day ie (100122 = Jan. 22 2010)

  • Returns an xml file which contains image ticket, image ticket will likely need to be escaped when placed in url.
  • add to url in querystring ticket=
  • pass authentication header described in #1 to url. 
  • This ticket can then be used to get images from either javascript or flash player. 
  • If wish to use in flash player you'll need to contact us to add your domain to our crossdomain.xml.

 B)  Javascript

You can alternately get an image ticket without modifying backend code using javascript.

To web service account management page add domain(s) you'd like to authorize for your account (ie. www.mysite.com and mysite.com)

To html page add script tag:
<script src="http://api.livedesigner.com/{yourusername}/LDWSAuthJS" type="text/javascript"></script>

Replace yourusername with your username.

Then when url dynamically created in javascript call function LDWSAddAuthToUrl (ie. newurl=LDWSAddAuthToUrl(url)).  newurl will then have authentication ticket appended to it if your domain is correctly added.