About this article
This article will guide you on how to create an API for a Custom Content Connector integration between your internal Digital Asset Management system and Templafy's Library. In other words, such content integration will make it possible to surface images, slides, slide elements, text elements, email elements, and PDFs directly within Templafy Library.
This will make it possible for the images to be widely available right where they are needed when working on your documents, presentations, or emails.
Prerequisites
|
Step by step guide:
To create a Custom Content Integration, all that must be done is to implement three simple endpoints:
POST /oauth/token:
formData:
- grant_type (string): will always “client_credentials”
- client_id (string): Client ID configured in the Templafy Admin Center
- client_secret (string): Client secret configured in the Templafy Admin Center
Returns:
- Object containing
- access_token (string): Access token which can be used to access the data in the integration
Response example:
{
”access_token”: ”kfjdskjfldsjflsdjlffhjsdfhksdjhfkjds”
}
GET/content
API endpoint that Templafy will request to the external service in order to get the content of a specific folder (or the root), that should be shown in the Templafy interface. If the external service doesn’t have folders, it’s not needed to return any folders. Any folders should be returned first in the list
Header values:
- Authorization: Will contain the access_token retrieved previously in this format: “Bearer
ACCESS_TOKEN”
Query Parameters:
- contentType (string): Will specify what type of content is being requested. Possible values are image / textElement / slide / slideElement / pdf / emailElement
- limit (integer): Limits the amount of items to return
- skip (integer): Skip the first x items, used for paging
- parentId (string, optional): Id of the parent of which to show content
- search (string, optional): Content to search for, contains the users search string
Returns:
- contentCount (integer): Total number of results
- offset (integer): Current offset
- content: Array of objects containing:
- id (string): ID of the image
- mimeType (string): Mime type of the content. Can be of type
- application/vnd.templafy.folder
- image/jpeg
- image/png
- image/svg+xml
- application/pdf
- application/vnd.openxmlformats-officedocument.wordprocessingml.document
- application/vnd.openxmlformats-officedocument.presentationml.presentation
- previewUrl (string): Link to a thumbnail size image signed with short life signature. Should be publicly accessible
- name (string): Name of the asset
- tags (string): Tags of the asset. Separated by a comma “,”
Response example:
{
"contentCount": "32",
"offset": "12",
"content": [
{
"mimeType": "application/vnd.templafy.folder",
"name": "Test folder",
"id": "efjh23j4hjk23h4234"
},
{
"id": "472364786327468723",
"mimeType": "image/png",
"name": "Templafy logo.png",
"previewUrl": "Public SAS link",
"tags": "Tag1, tag2",
}
]
}
GET /content/{contentId}/download-url:
API endpoint that Templafy will request to the external service in order to get the download Url of a specific image, which will, then be downloaded by Templafy and given to the user
Header values:
- Authorization: Will contain the access_token retrieved previously in this format: “Bearer
ACCESS_TOKEN”
URL Path parameters:
- contentId (string): Id of the content
Returns:
- downloadUrl (string): Generated shared access link to the full size content
Response example:
"https://linktocontent.com/?token=shortlivedsecuretoken"
|
Comments
0 comments
Article is closed for comments.