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 |
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. The default value is |
|
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. |
FontList
Name | Type | Notes |
---|---|---|
total | integer (int32) | |
items |
|
FontInfo
Name | Type | Notes |
---|---|---|
fullName | string | |
style | string | |
family | string | |
postscriptName | string |
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 | |
fullInfo | boolean |
FramesInfo
Name | Type | Notes |
---|---|---|
size |
|
|
layers |
|
Size
Name | Type | Notes |
---|---|---|
width | integer (int32) | |
height | integer (int32) |
BaseLayer
Name | Type | Notes |
---|---|---|
name | string | |
type | string |
PreviewModel
Name | Type | Notes |
---|---|---|
format | string | |
size | object | |
jpegQuality | integer (int32) | |
optimizePreview | boolean | |
unsharpMask | object | |
template | string | |
data | object | |
preloadImages | boolean |
HiresModel
Name | Type | Notes |
---|---|---|
template | string | |
data | object | |
preloadImages | boolean |
MultipagePreviewModel
Name | Type | Notes |
---|---|---|
pages |
|
MultipageRenderingResponseModel
Links to rendering results.
Name | Type | Notes |
---|---|---|
results |
|
RenderingResponseModel
Name | Type | Notes |
---|---|---|
url | string |
MultipageHiresModel
Name | Type | Notes |
---|---|---|
combine | boolean | |
pages |
|
TemplateList
Name | Type | Notes |
---|---|---|
total | integer (int32) | |
items | array |