Retrieve Template Information
Retrieves information about a document template
Endpoint URL | SDK Method |
---|---|
N/A | Template.get() |
Request properties
Property | Type | Required | Description |
---|---|---|---|
templateId | String | Yes | The ID of a template that was previously created. |
Response properties
Property | Type | Description |
---|---|---|
created_at | String | The date and time the template was created. |
description | String | The description of the template. |
destinations | Object | Details about where and how to store documents generated from the template. |
file | String | The contents of the template if source equals docx or pdf . |
file_name | String | The file name of the template source if source equals docx or pdf . |
height | Float | The height of documents generated by the template if source equals html . |
html | String | The template's HTML code if source equals html . |
id | String | The ID of the template. |
merge_params | Object | The descriptions and locations of merge fields if source equals pdf . |
merge_variables | Object | The key-value pairs used when generating documents from the template. |
name | String | The name of the template. |
source | String | The source format of the template. Valid values are docx , html and pdf . |
unit | String | The unit of measurement for documents generated by the template. Valid values are in and cm . |
updated_at | String | The date and time the template was updated. |
version | Integer | The version number of the template. |
version_history | Object | The version history of the template. |
width | String | The width of documents generated by the template if source equals html . |
merge_params
merge_params
Property | Type | Description |
---|---|---|
align | String | The text alignment of the field. |
fontname | String | The font name of the field. |
fontsize | String | The font size of the field. |
name | String | The name of the field. |
page | String | The page number of the PDF where the field exists. |
text_color | Integer[] | The text color of the field. |
x_left | Integer | The left coordinate of the field. |
x_right | Integer | The right coordinate of the field. |
y_lower | Integer | The bottom coordinate of the field. |
y_upper | Integer | The top coordinate of the field. |
version_history
version_history
Property | Type | Description |
---|---|---|
created_at | String | The date and time the template version was created. |
edited_by_first_name | String | The first name of the user who edited the template. |
edited_by_last_name | String | The last name of the user who edited the template. |
version | Integer | The template version number. |
Example request and response
# Import the Inkit Python package
import inkit
from inkit.exceptions import InkitResponseException
# Import json package
import json
# Replace the string below with your API key
inkit.api_token = "ENTER YOUR API KEY"
try:
# Get data about a template
resp = inkit.Template.get('ENTER YOUR TEMPLATE ID')
# Print the repsonse code of the API call
print(json.dumps(resp.data, indent = 3))
except InkitResponseException as err:
# Print any error
print(err.response.data)
// Import the Inkit Node.js package
const Inkit = require("inkit");
// Replace the string below with your API key
Inkit.apiToken = "ENTER YOUR API KEY";
// Call get template
getTemplate();
// Get data about a template
async function getTemplate() {
try {
const result = await Inkit.Template.get('ENTER YOUR TEMPLATE ID');
// Print the JSON response of the API call
console.log(JSON.stringify(result.data, null, 3));
} catch (error) {
// Print any error
console.error(error.response.status, error.response.statusText);
}
}
{
"created_at": "2023-09-06T14:43:36.773986Z",
"description": "",
"destinations": [
{
"expire_after_n_views": null,
"folder_id": null,
"id": "dest_4UNZXxK3OYqBIYPPB5mu4P",
"name": "inkit_storage",
"required": true,
"retain_for": null
}
],
"height": 11.0,
"html": "<html>{{Name}}</html>",
"id": "tmpl_27i7Mb5bBIKzXVHOKfSedc",
"merge_variables": {
"Name": null
},
"name": "Test",
"source": "html",
"unit": "in",
"updated_at": "2023-09-06T14:43:36.773997Z",
"version": 1,
"version_history": [
{
"created_at": "2023-09-06T14:43:36.773997Z",
"edited_by_first_name": "John",
"edited_by_last_name": "Doe",
"version": 1
}
],
"width": 8.5
}
Updated 11 months ago