Skip to content

POST Upload Templates

Base URLs

Demo URL: https://demoapi.openletterconnect.com/api/v1

Production URL: https://api.openletterconnect.com/api/v1

{{base_url}}/templates/upload

Description

This endpoint is used to upload new templates to the system. Users can provide various files, including the main template, thumbnail, back template, and back thumbnail, as form data. The response will include a confirmation message indicating that the template was uploaded successfully, along with the paths to the uploaded files in the system.

AUTHORIZATION

Bearer Token

  • Token: {{jwt_token}}

Pre-Requiest

Since you're using the Upload Template API, ensure you first upload the required files. The files to be uploaded are:

  1. Template File: This file (e.g., a JSON file) contains the structure or content of the template.
  2. Thumbnail File: This file serves as the visual representation or preview of the template.

Once the files are uploaded via the Upload Template API, you'll receive the file paths for both the {{TemplatePath}} and {{thumbnailPath}} fields. These file paths are mandatory when making the subsequent API call to create a template. Without these paths, the template creation will fail.

Example Request

curl --location -g '{{base_url}}/templates/upload' \
--form 'thumbnail=@"/home/usman/Downloads/logo.png"' \
--form 'html=@"/home/usman/Desktop/olc/samples/template.html"' \
--form 'backHtml=@"/home/usman/Desktop/olc/samples/back-template.html"'

Example Response

{
  "message": "Template Uploaded Successfully.",
  "data": {
    "templatePath": "s3/openletterconnect/org-2/user-3/templates/upload/html/1702379710452-template.html",
    "thumbnailPath": "s3/openletterconnect/org-2/user-3/templates/upload/thumbnail/1702379710451-logo.png",
    "backTemplatePath": "s3/openletterconnect/org-2/user-3/templates/upload/backHtml/1702379710452-back-template.html"
  }
}