Dynamic Image API
BuildInfo
Controller for getting information about the application.
GetInfo
Returns the version, build date, build configuration, and application name.
Request Example:
$.ajax({
url: "http://localhost:84/api/info",
type: "GET",
success: function(d) {
console.log(d);
},
error: function(d) {
console.error(d.responseText);
}
});
Request
GET /api/Info
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 |
|
Returns the build info |
|
500 | Server Error |
HeadInfo
Returns the version, build date, build configuration, and application name.
Request Example:
$.ajax({
url: "http://localhost:84/api/info",
type: "HEAD",
success: function(d) {
console.log(d);
},
error: function(d) {
console.error(d.responseText);
}
});
Request
HEAD /api/Info
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 | Returns the build info in response headers |
||
500 | Server Error |
ColorProfiles
Controller for getting information about fonts.
Templates
Returns a list of templates stored on the server.
Request Example:
http://localhost:84/api/resources/colorprofiles?showSubfolders=true
Request
GET /api/resources/colorprofiles[?subfolder&showSubfolders]
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
subfolder | query | A folder where this endpoint obtains the color profile list. By default, this is an empty string, which means that this method looks for color profiles in the folder defined as the |
||
showSubfolders | query | False | If |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 |
|
Returns a color profile list |
|
500 | Server Error |
Fonts
Controller for getting information about fonts.
Fonts
Returns a list of available fonts and their properties.
Request Example:
http://localhost:84/api/resources/fonts
Every element in the resulting list contains a full name, a font style, a font family, and a postScript name that you can use for personalization.
Request
GET /api/resources/fonts
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 |
|
Returns a font list |
|
500 | Server Error |
Reload
Reloads fonts.
Request Example:
$.ajax({
url: "http://localhost:84/api/resources/fonts/reload",
type: "POST",
success: function(d) {
console.log(d);
},
error: function(d) {
console.error(d.responseText);
}
});
This endpoint scans the folder defined as the FontPath
in AppSettings.config
. After you have changed fonts in this folder, you should reload the font list to apply changes to the web service.
NOTE: If you have changed the FontPath
parameter, you must recycle the app pool.
Request
POST /api/resources/fonts/reload
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 | Reloads the fonts |
||
500 | Server Error |
Images
Controller for getting and manipulating images.
Images
Returns a list of images placed on the server and available for personalization.
Request Example:
http://localhost:84/api/resources/images?showSubfolders=true
Request
GET /api/resources/images[?subfolder&showSubfolders]
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
subfolder | query | Specifies a folder where this endpoint obtains the image list. By default, this is an empty string, which means that this method looks for images in the folder defined as the |
||
showSubfolders | query | False | Allows you to list images in subfolders. By default, this is |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 |
|
Returns an image list |
|
500 | Server Error |
PostImage
Uploads images to the server.
Request Example:
<input type="file" class="inputfile" name="logo" id="logo" placeholder="Company Logo" onchange="uploadLogo(event)" />
...
function uploadLogo(e) {
var formData = new FormData();
var file = $('#logo')[0].files[0];
formData.append('file', file);
if (file) {
$.ajax({
url: 'https://localhost:84/api/resources/images?destination=uploaded',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(d) {
console.log(d[0].previewUrl);
},
error: function(d) {
console.error(d.responseText);
}
});
}
}
You can also pass a number of files as multipart/form-data
in this request payload.
Request
POST /api/resources/images/{destination}[?overwrite]
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
*destination | path | A destination subfolder. If this is a new subfolder, it will be created. By default, this is an empty string, which means that images will be uploaded to the folder defined as the |
||
overwrite | query | False | If |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 |
|
Uploads images to the server |
|
500 | Server Error |
ImagePreview
Returns an image preview.
You can use this method to obtain the content of IMG elements as follows:
<img src="http://example.com/api/resources/images/preview?file=rose.jpg&height=400" />
Request
GET /api/resources/images/preview?model.file[&model.format&model.jpegQuality&model.width&model.height&model.disableCache&model.unsharpMask]
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
*model.file | query | The image file name. |
||
model.format | query | jpg | The output file format, either |
|
model.jpegQuality | query | 85 | The quality of JPEG files, in the range [0,100]. The default value is |
|
model.width | query | 400 | The image width, in pixels. The default value is |
|
model.height | query | 400 | The image height, in pixels. The default value is |
|
model.disableCache | query | False | If |
|
model.unsharpMask | query | (1.2, 0.5, 0.05) | Defines whether to make an image look sharper. If |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 | Returns a file stream |
||
500 | Server Error |
Information
Controller for getting information about PSD files.
Template
Returns information about a PSD template.
Request Example:
var model = {
"template": "badge",
"fullInfo": false
};
$.ajax({
url: "http://localhost:84/api/information/template",
type: "POST",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: JSON.stringify(model),
success: function(d) {
console.log(d);
},
error: function(d) {
console.error(d.responseText);
}
});
In the request response, you will get a JSON with info about the template. For example:
{
"size": {
"width": 800,
"height": 640
},
"layers": [
{
"name": "Photo",
"type": "Image"
},
{
"name": "Name",
"type": "Text"
}
]
}
Request
POST /api/information/template
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
*model | body |
|
A JSON object that defines the file name. |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 |
|
Returns template details |
|
500 | Server Error |
Rendering
Controller for rendering templates.
Preview
Renders a PSD template and returns a URL to display the preview in a browser.
Request Example:
var data = {
template: "games.psd",
format: "png"
};
$.ajax({
url: "http://localhost:84/api/rendering/preview",
type: "POST",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: JSON.stringify(data),
success: function(d) {
console.log(d);
},
error: function(d) {
console.error(d.responseText);
}
});
Response Example:
"http://localhost:84/api/results/download/1f78f1d8-cf23-45a0-ac47-ef57774cd435.png/"
Request
POST /api/rendering/preview[?disableCache]
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
*model | body |
|
Rendering parameters |
|
disableCache | query | False | Enables rendering and loading assets every time you make requests. By default, this is |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 | string | Returns a link to the rendered preview |
|
500 | Server Error |
Hires
Renders a PSD template and returns a URL that links to the print-ready PDF file.
Request Example:
var payload = {
template: "games.psd",
data: {
Team: {
type: "text",
text: "Washington Capitals"
}
}
};
$.ajax({
url: "http://localhost:84/api/rendering/hires",
type: "POST",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: JSON.stringify(payload),
success: function(d) {
console.log(d);
},
error: function(d) {
console.error(d.responseText);
}
});
Response Example:
"http://localhost:84/api/results/download/d8040e7e-53ed-406e-aef6-15e41b39a5c2.pdf/"
Request
POST /api/rendering/hires[?disableCache]
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
*model | body |
|
Rendering parameters |
|
disableCache | query | False | Enables rendering and loading assets every time you make requests. By default, this is |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 | string | Returns a link to the print file |
|
500 | Server Error |
MultipagePreview
Generates preview images for several PSD files to display them in a browser.
In the request payload, this request accepts the pages
array defining parameters to render several PSD file.
Request Example:
var model = {
"pages": [
{
"template": "calendar-sample"
},
{
"template": "games.psd",
"format": "png"
}
]
};
$.ajax({
url: "http://localhost:84/api/rendering/multipage/preview",
type: "POST",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: JSON.stringify(model),
success: function(d) {
console.log(d);
},
error: function(d) {
console.error(d.responseText);
}
});
In the request response, you will get a JSON with an array of links to the rendered previews. For example:
{
"results": [
{
"url": "http://localhost:17395/api/results/download/?file=AA4A29399EC558951129149939092EE0.jpeg"
},
{
"url": "http://localhost:17395/api/results/download/?file=C71143396DE51525457F1020170EB29D.png"
}
]
}
Request
POST /api/rendering/multipage/preview[?disableCache]
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
*model | body |
|
A JSON object that contains a |
|
disableCache | query | False | Enables rendering and loading assets every time you make requests. By default, this is |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 |
|
Returns links to rendered images |
|
500 | Server Error |
MultipageHires
Renders several PSD files and generates a multi-page PDF file of print-ready images.
In the request payload, this request accepts the pages
array defining parameters to render several PSD file.
Request Example:
var model = {
"pages": [
{
"template": "calendar-sample"
},
{
"template": "games"
}
]
};
$.ajax({
url: "http://localhost:84/api/rendering/multipage/hires",
type: "POST",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: JSON.stringify(model),
success: function(d) {
console.log(d);
},
error: function(d) {
console.error(d.responseText);
}
});
In the request response, you will get a JSON with an array of one or more links to print files. For example:
{
"results": [
{
"url": "http://localhost:17395/api/results/download/?file=16D258EB44FBD814100DBCFCA90BD64B.pdf"
}
]
}
Request
POST /api/rendering/multipage/hires[?disableCache]
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
*model | body |
|
A JSON object that contains a |
|
disableCache | query | False | Enables rendering and loading assets every time you make requests. By default, this is |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 |
|
Returns links to rendered images |
|
500 | Server Error |
Results
Controller for downloading and removing the rendered files.
Get
Returns a file stream or an error if the file does not exist.
Request Example:
http://localhost:84/api/results/download?file=065F92ED8B5D750AF7E2FAF8261FA05B.jpg
Request
GET /api/results/download/{file}
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
*file | path | The file name. |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 | Returns a file stream |
||
500 | Server error |
Delete
Delete result file. Requires X-DynamicImageApiKey
header.
Request Example:
const url = 'http://localhost:84/api/results/delete?file=file.pdf';
const response = await fetch(url, {
method: 'DELETE',
headers: {'X-DynamicImageApiKey': 'UniqueApiKey'}
});
Request
DELETE /api/results/delete/{file}
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
*file | path | The file name. |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 | File deleted |
||
403 | Authentication error |
||
500 | Server error |
Templates
Controller for getting the template list.
Templates
Returns a list of templates stored on the server.
Request Example:
http://localhost:84/api/resources/templates?showSubfolders=true
Request
GET /api/resources/templates[?subfolder&showSubfolders]
Parameters
Name | In | Type | Default | Notes |
---|---|---|---|---|
subfolder | query | A folder where this endpoint obtains the template list. By default, this is an empty string, which means that this method looks for templates in the folder defined as the |
||
showSubfolders | query | False | If |
Responses
Status Code | Type | Description | Samples |
---|---|---|---|
200 |
|
Returns a template list |
|
500 | Server Error |
Definitions
BuildInfo
Application details.
Name | Type | Notes |
---|---|---|
version | string | The build version. |
buildDate | string | The build date. |
configuration | string | The build configuration. |
appName | string | The application name. |
ColorProfileList
A list of available color profiles.
Name | Type | Notes |
---|---|---|
total | integer (int32) | The number of items in the list. |
items |
|
The list of items. |
ColorProfile
The list of items.
Name | Type | Notes |
---|---|---|
deviceClass | string | Gets a profile device class (i.e. what kind of devices it is intended for). |
colorSpace | string | Gets the color space of this color profile. |
copyright | string | Gets a copyright information stored in the color profile. |
model | string | Gets a device model name. |
manufacturer | string | Gets a device manufacturer name. |
description | string | Gets a profile description. |
FontList
A list of available fonts.
Name | Type | Notes |
---|---|---|
total | integer (int32) | The number of items in the list. |
items |
|
The list of items. |
FontInfo
The list of items.
Name | Type | Notes |
---|---|---|
fullName | string | The combination of a font family and a font name. |
style | string | The font style. |
family | string | The font family. |
postscriptName | string | The postscript name of the font. |
ImageList
A structure containing a list of images on the server.
Name | Type | Notes |
---|---|---|
total | integer (int32) | The number of images in the list. |
items |
|
The list of images. |
ImageModel
The list of images.
Name | Type | Notes |
---|---|---|
title | string | The image title. |
name | string | The file name. |
previewUrl | string | A URL to preview the image. |
InformationTemplateModel
Name | Type | Notes |
---|---|---|
template | string | The file name of a PSD template (required). |
fullInfo | boolean | If |
FramesInfo
Name | Type | Notes |
---|---|---|
size |
|
The image size. |
layers |
|
An array of layers in a PSD file. |
Size
The image size.
Name | Type | Notes |
---|---|---|
width | integer (int32) | The image width. |
height | integer (int32) | The image height. |
BaseLayer
An array of layers in a PSD file.
Name | Type | Notes |
---|---|---|
name | string | The layer name. |
type | string | The layer type. |
locked | boolean | Is the layer locked. |
PreviewModel
Parameters for rendering previews.
Name | Type | Notes |
---|---|---|
format | string | The output file format, either |
size | object | The image size, in pixels. By default, it is |
jpegQuality | integer (int32) | The quality of JPEG files, in the range [0,100]. The default value is |
optimizePreview | boolean | Enables optimization of preview images. NOTE! This parameter allows you to speed up generating a preview but it may introduce such artifacts as blurring or other. |
unsharpMask | object | Defines whether to make an image look sharper. If |
template | string | The file name of a PSD template (required). |
data | object | The personalization data. |
preloadImages | boolean | Makes the rendering process faster. If |
HiresModel
Parameters for rendering PDF print files.
Name | Type | Notes |
---|---|---|
pdfFormat | string | The format of the PDF file, either |
template | string | The file name of a PSD template (required). |
data | object | The personalization data. |
preloadImages | boolean | Makes the rendering process faster. If |
MultipagePreviewModel
Parameters for rendering a number of PSD files.
Name | Type | Notes |
---|---|---|
pages |
|
An array of definitions of preview images. |
MultipageRenderingResponseModel
Links to rendering results.
Name | Type | Notes |
---|---|---|
results |
|
RenderingResponseModel
Name | Type | Notes |
---|---|---|
url | string |
MultipageHiresModel
Parameters for rendering a number of PSD files.
Name | Type | Notes |
---|---|---|
combine | boolean | If |
pages |
|
An array of definitions of preview images. |
TemplateList
A list of available templates.
Name | Type | Notes |
---|---|---|
total | integer (int32) | The number of items in the list. |
items | array | The list of items. |