Skip to main content

Thumbnail v3.1

The Thumbnail API is used to generate a jpg image representation of HTML or Text content. The image is hosted by MessageGears and can be reference at http://thumbnails.messagegears.net/<account id>/<image id>.jpg. The Image URL is also returned in the response from a successful API call.

Deprecated Versions​

(none)

Required Parameters​

ParameterDescription
ActionThumbnail
AccountIdThe MessageGears account id to which this item belongs.
ApiKeyA secret key only known by you. Keep this key confidential.
ContentThe HTML or text content to be rendered as an image
ImageIdThe base name of the image file to be created. It will be appended with the ".jpg" extension automatically.
ImageSizeThe size of the image to be created. Value values are: MICRO, SMALL, SMEDIUM, MEDIUM, LARGE, and GRANDE. The sizes of the images are 64 x 48, 80 x 60, 220 x 165, 232 x 174, 400 x 300, and 800 x 600 respectively.

Programming Examples​

REST​

Request

https://api.messagegears.net/3.1/WebService  
?Action=Thumbnail
&AccountId=123456789
&ApiKey=8bb6118f8fd6935ad0876a3be34a717d32708ffd
&Content=<html>Hello, World!</html>
&ImageId=12345
&ImageSize=MEDIUM

Response

<ThumbnailResponse>  
<RequestId>i3012-ae148ce1-a991-4304-984d-b3b4b0354970</RequestId>
<Result>REQUEST_SUCCESSFUL</Result>
<imageUrl>http://thumbnails.messagegears.net/123456789/12345.jpg</imageUrl>
</ThumbnailResponse>

Java SDK​

Click here for more information on using the MessageGears Java SDK

package com.messagegears.examples;

import com.messagegears.sdk.MessageGearsClient;
import com.messagegears.sdk.MessageGearsProperties;
import com.messagegears.sdk.model.ThumbnailSize;
import com.messagegears.sdk.model.request.ThumbnailRequest;
import com.messagegears.sdk.output.ScreenWriter;
import com.messagegears.sdk.v3_1.ThumbnailResponse;

public class Thumbnail {

public static final String MY_EMAIL_ADDRESS = "place your email address here";
public static final String MY_MESSAGEGEARS_ACCOUNT_ID = "place your MessageGears account id here";
public static final String MY_MESSAGEGEARS_API_KEY = "place your MessageGears api key here";

public static void main(String[] args) {
// Update the properties object containing the necessary properties
MessageGearsProperties properties = new MessageGearsProperties();
properties.setMyMessageGearsAccountId(MY_MESSAGEGEARS_ACCOUNT_ID);
properties.setMyMessageGearsApiKey(MY_MESSAGEGEARS_API_KEY);

// Update the main client object
MessageGearsClient client = new MessageGearsClient(properties);

// Update a bulk campaign request
ThumbnailRequest request = new ThumbnailRequest();

// Set the content for the thumbnail
request.setContent("<html>Hello, World!</html>");

// Set the image file name (prefix)
request.setImageId("12345");

// Set the thumbnail image size
request.setThumbnailSize(ThumbnailSize.MEDIUM);

// Execute the request
ThumbnailResponse response = client.thumbnail(request);

// Print the result (success or failure)
ScreenWriter.printResponse(response);
}
}

C# SDK​

Click here for more information on using the MessageGears .Net SDK

using System;
using MessageGears;
using MessageGears.Model;
using MessageGears.Model.Generated;

namespace MessageGears.Sample
{
public class ThumbnailSample
{
// Replace this value with your email address
public const String MY_EMAIL_ADDRESS = "place your email address here";
public const String MY_MESSAGEGEARS_ACCOUNT_ID = "place your MessageGears account id here";
public const String MY_MESSAGEGEARS_API_KEY = "place your MessageGears api key here";

public static void Main()
{
// Create the properties object containing the necessary properties
MessageGearsProperties props = new MessageGearsProperties();
props.MyMessageGearsAccountId = MY_MESSAGEGEARS_ACCOUNT_ID;
props.MyMessageGearsApiKey = MY_MESSAGEGEARS_API_KEY;

// Create the main client object
MessageGearsClient client = new MessageGearsClient(props);

// Create a request
ThumbnailRequest request = new ThumbnailRequest();

// Set the thumbnail image content
request.Content = "<html>Hello, World!</html>";

// Set the image file name prefix
request.ImageId = "12345";

// Set the image size
request.ThumbnailSize = ThumbnailSize.MEDIUM;

// Execute the request
ThumbnailResponse response = client.Thumbnail(request);

// Print the result (success or failure)
Console.WriteLine("Image URL: " + response.imageUrl);
client.PrintResponse(response);
}
}
}

Sample Thumbnail Images​

Content = <html>Hello, World!</html>

MICRO (64 x 48)

SMALL (80 x 60)

SMEDIUM (220 x 165)

MEDIUM (232 x 174)

LARGE (400 x 300)

GRANDE (800 x 600)