{"_id":"59796d1140a3a2001f068cbf","category":{"_id":"59796d1140a3a2001f068cb7","version":"59796d1140a3a2001f068cb4","project":"5669937dfc5abf2300afe7de","__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-01-06T19:42:14.381Z","from_sync":false,"order":2,"slug":"templates","title":"Templates"},"parentDoc":null,"user":"54343147fa5527080064f43f","project":"5669937dfc5abf2300afe7de","version":{"_id":"59796d1140a3a2001f068cb4","project":"5669937dfc5abf2300afe7de","__v":2,"createdAt":"2017-07-27T04:33:21.278Z","releaseDate":"2017-07-27T04:33:21.278Z","categories":["59796d1140a3a2001f068cb5","59796d1140a3a2001f068cb6","59796d1140a3a2001f068cb7","59796d1140a3a2001f068cb8","5acb7bc606a2ce0003f28da4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0"},"githubsync":"","__v":4,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-06T20:25:58.351Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","examples":{"codes":[{"language":"curl","code":"curl 'https://api.safestream.com/1.0/templates'\\\n  --data-binary '\\\n    {\\\n      \"name\":\"Intended for [%firstName%] [%lastName%]\",\\\n      \"description\":\"A template that watermarks first first name and last name\",\\\n      \"settings\":[{\\\n        \"x\":0.5,\\\n        \"y\":0.5,\\\n        \"fontOpacity\":0.75,\\\n        \"fontSize\":0.08,\\\n        \"fontColor\":\"0xFFFFFF\",\\\n        \"content\":\"Custom watermark\",\\\n        \"align\":\"LEFT\",\\\n        \"verticalAlign\":\"TOP\"\\\n       }]\\\n     }'"}]},"method":"post","results":{"codes":[{"name":"","code":"{\n  \"data\": {\n    \"id\": \"1\",\n    \"name\": \"Intended for [%firstName%] [%lastName%]\",\n    \"description\": \"A template that watermarks first first name and last name\",\n    \"watermarkSettings\": [\n      {\n        \"content\": \"Custom watermark\",\n        \"type\": \"TEXT\",\n        \"x\": 0.5,\n        \"y\": 0.5,\n        \"fontSize\": 0.08,\n        \"fontOpacity\": 0.75,\n        \"fontColor\": \"0xFFFFFF\",\n        \"shadowOpacity\": 0,\n        \"shadowColor\": \"0xFFFFFF\",\n        \"shadowOffsetX\": 0.01,\n        \"shadowOffsetY\": 0.1,\n        \"align\": \"LEFT\",\n        \"verticalAlign\": \"TOP\",\n        \"animation\": [\n          {\n            toX: \"-0.5\",\n            toY: \"0.5\",\n            startTime: \"0\",\n            endTime: \"60\"\n          }\n        ]\n      }\n    ],\n    \"createdBy\": \"1\",\n    \"createdOn\": 1475780677603,\n    \"updatedBy\": \"1\",\n    \"updatedOn\": 1475780677603\n  }\n}","language":"json","status":200},{"code":"{\n  \"message\":\"A template with the name I am become cat, meower of worlds already exists\"\n}","status":409,"language":"json"}]},"auth":"required","params":[{"_id":"57f6a9c6ca5e5d1700039b02","ref":"","in":"body","required":false,"desc":"The unique name of this template","default":"","type":"string","name":"name"},{"_id":"57f6a9c6ca5e5d1700039b01","ref":"","in":"body","required":false,"desc":"A description for this template","default":"\"\"","type":"string","name":"description"},{"_id":"57f6a9c6ca5e5d1700039b00","ref":"","in":"body","required":false,"desc":"The watermark settings","default":"","type":"array_object","name":"settings"}],"url":"/templates"},"isReference":true,"order":1,"body":"The idea behind watermark templates is that you can keep the layout and style of the watermark consistent while making the content dynamic. Templates support placeholders. So, you can define variables that will be replaced with values at watermark time. \n\nThe following is a simple example that shows what a template could look like supporting a dynamic name:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"name\\\": \\\"my-example-watermark-temaplte\\\",\\n  \\\"settings\\\": [\\n    {\\n      \\\"content\\\": \\\"{name}\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Template Options\"\n}\n[/block]\nThis section provides example settings and templates that can be used to meet most common watermarking scenarios. The SafeStream template API provides many customization options that allow you to go beyond the templates listed here.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property Name\",\n    \"h-1\": \"Required\",\n    \"h-2\": \"Example\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"name\",\n    \"0-1\": \"Yes\",\n    \"0-2\": \"My Template\",\n    \"0-3\": \"The name of the template. This should be unique per account.\",\n    \"1-0\": \"description\",\n    \"1-1\": \"No\",\n    \"1-2\": \"This is a description of my template\",\n    \"1-3\": \"A description of the template.\",\n    \"2-0\": \"settings\",\n    \"2-1\": \"Yes\",\n    \"2-2\": \"An array of Objects describing the watermarks on the template.\",\n    \"2-3\": \"The watermark settings.\"\n  },\n  \"cols\": 4,\n  \"rows\": 3\n}\n[/block]\n**Settings** is an array of objects, where each object matches the following description.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property Name\",\n    \"h-1\": \"Required\",\n    \"h-2\": \"Example\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"content\",\n    \"0-1\": \"Yes\",\n    \"0-2\": \"User Name: [%firstName%] [%lastName%]\",\n    \"0-3\": \"Plain text, such as a users' name or email address\",\n    \"1-0\": \"fontColor\",\n    \"1-1\": \"No\",\n    \"1-3\": \"The hexadecimal color value for the content\",\n    \"1-2\": \"0xFFFFFF\",\n    \"2-0\": \"fontOpacity\",\n    \"2-1\": \"No\",\n    \"2-3\": \"0xFFFFFF\",\n    \"2-2\": \"0.5\",\n    \"3-0\": \"fontSize\",\n    \"3-1\": \"No\",\n    \"3-2\": \"0.5\",\n    \"3-3\": \"Value between 0 and 1. The ensure that watermark text is place within the frame of the video, the font size is relative to the width of the video. For most videos a font size between 0.05 and 0.15 is reasonable.\",\n    \"4-0\": \"x\",\n    \"4-1\": \"No\",\n    \"4-2\": \"0.5\",\n    \"4-3\": \"Relative horizontal position of the text. The position is relative to the size of the video. So, an x value of 0.5 will position the text in the horizontal center of the video.\",\n    \"5-0\": \"y\",\n    \"5-1\": \"No\",\n    \"5-2\": \"0.5\",\n    \"5-3\": \"Relative vertical position of the text. The position is relative to the size of the video. So, a y value of 0.5 will position the text in the vertical center of the video.\",\n    \"6-0\": \"align\",\n    \"6-1\": \"No\",\n    \"6-2\": \"CENTER\\nLEFT\\nRIGHT\",\n    \"6-3\": \"Relative horizontal position of the text. The position is relative to the size of the video. So, an x value of 0.5 will position the text in the horizontal center of the video.\",\n    \"7-0\": \"verticalAlign\",\n    \"7-1\": \"No\",\n    \"7-2\": \"TOP\\nCENTER\\nBOTTOM\",\n    \"7-3\": \"Relative vertical position of the text. The position is relative to the size of the video. So, a y value of 0.5 will position the text in the vertical center of the video.\",\n    \"8-0\": \"shadowColor\",\n    \"9-0\": \"shadowOffsetX\",\n    \"10-0\": \"shadowOffsetY\",\n    \"11-0\": \"shadowOpacity\",\n    \"8-1\": \"No\",\n    \"8-2\": \"0x000000\",\n    \"9-1\": \"No\",\n    \"10-1\": \"No\",\n    \"11-1\": \"No\",\n    \"9-2\": \"0.08\",\n    \"10-2\": \"0.08\",\n    \"11-2\": \"0.33333334\",\n    \"8-3\": \"The hexadecimal color value for the shadow\",\n    \"9-3\": \"Percentage offset from the main text\",\n    \"10-3\": \"Percentage offset from the main text\",\n    \"11-3\": \"Opacity of the shadow, value between 0-1.\"\n  },\n  \"cols\": 4,\n  \"rows\": 12\n}\n[/block]\n**Advanced Settings:** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\t\\\"name\\\": \\\"A brand new template\\\",\\n  \\t\\\"description\\\": \\\"Here, we can describe our new template\\\",\\n    \\\"settings\\\": [\\n           {\\n      \\\"content\\\": \\\"[%firstName%] [%lastName%]\\\",\\n      \\\"fontColor\\\": \\\"FFFFFF\\\",\\n      \\\"y\\\": 0.02,\\n      \\\"x\\\": 0.02,\\n      \\\"fontOpacity\\\": 0.5,\\n      \\\"fontSize\\\": 0.04,\\n      \\\"align\\\": \\\"LEFT\\\",\\n      \\\"verticalAlign\\\": \\\"TOP\\\",\\n      \\\"shadowColor\\\": \\\"000000\\\",\\n      \\\"shadowOffsetX\\\": 0.08,\\n      \\\"shadowOffsetY\\\": 0.08,\\n      \\\"shadowOpacity\\\": 0.33\\n    },\\n    {\\n      \\\"content\\\": \\\"ACME Studios\\\",\\n      \\\"fontColor\\\": \\\"FFFFFF\\\",\\n      \\\"y\\\": 0.02,\\n      \\\"x\\\": 0.98,\\n      \\\"fontOpacity\\\": 0.5,\\n      \\\"fontSize\\\": 0.04,\\n      \\\"align\\\": \\\"RIGHT\\\",\\n      \\\"verticalAlign\\\": \\\"TOP\\\",\\n      \\\"shadowColor\\\": \\\"000000\\\",\\n      \\\"shadowOffsetX\\\": 0.08,\\n      \\\"shadowOffsetY\\\": 0.08,\\n      \\\"shadowOpacity\\\": 0.33\\n    },\\n      {\\n      \\\"content\\\": \\\"PROPERTY OF ACME\\\",\\n      \\\"fontColor\\\": \\\"FFFFFF\\\",\\n      \\\"y\\\": 0.5,\\n      \\\"x\\\": 0.5,\\n      \\\"fontOpacity\\\": 0.1,\\n      \\\"fontSize\\\": 0.1,\\n      \\\"align\\\": \\\"CENTER\\\",\\n      \\\"verticalAlign\\\": \\\"MIDDLE\\\",\\n      \\\"shadowColor\\\": \\\"000000\\\",\\n      \\\"shadowOffsetX\\\": 0.08,\\n      \\\"shadowOffsetY\\\": 0.08,\\n      \\\"shadowOpacity\\\": 0.33\\n    },\\n    {\\n      \\\"content\\\": \\\"DO NOT DISTRIBUTE\\\",\\n      \\\"fontColor\\\": \\\"FFFFFF\\\",\\n      \\\"y\\\": 0.96,\\n      \\\"x\\\": 0.98,\\n      \\\"fontOpacity\\\": 0.5,\\n      \\\"fontSize\\\": 0.04,      \\n      \\\"align\\\": \\\"RIGHT\\\",\\n      \\\"verticalAlign\\\": \\\"MIDDLE\\\",\\n      \\\"shadowColor\\\": \\\"000000\\\",\\n      \\\"shadowOffsetX\\\": 0.08,\\n      \\\"shadowOffsetY\\\": 0.08,\\n      \\\"shadowOpacity\\\": 0.33\\n    }        \\n    ]\\n}\\n\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"Create reusable and dynamic watermark settings","slug":"creating-templates","type":"endpoint","title":"Creating a Template"}

postCreating a Template

Create reusable and dynamic watermark settings

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

name:
string
The unique name of this template
description:
string""
A description for this template
settings:
array of objects
The watermark settings

Examples


Result Format


Documentation

The idea behind watermark templates is that you can keep the layout and style of the watermark consistent while making the content dynamic. Templates support placeholders. So, you can define variables that will be replaced with values at watermark time. The following is a simple example that shows what a template could look like supporting a dynamic name: [block:code] { "codes": [ { "code": "{\n \"name\": \"my-example-watermark-temaplte\",\n \"settings\": [\n {\n \"content\": \"{name}\"\n }\n ]\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Template Options" } [/block] This section provides example settings and templates that can be used to meet most common watermarking scenarios. The SafeStream template API provides many customization options that allow you to go beyond the templates listed here. [block:parameters] { "data": { "h-0": "Property Name", "h-1": "Required", "h-2": "Example", "h-3": "Description", "0-0": "name", "0-1": "Yes", "0-2": "My Template", "0-3": "The name of the template. This should be unique per account.", "1-0": "description", "1-1": "No", "1-2": "This is a description of my template", "1-3": "A description of the template.", "2-0": "settings", "2-1": "Yes", "2-2": "An array of Objects describing the watermarks on the template.", "2-3": "The watermark settings." }, "cols": 4, "rows": 3 } [/block] **Settings** is an array of objects, where each object matches the following description. [block:parameters] { "data": { "h-0": "Property Name", "h-1": "Required", "h-2": "Example", "h-3": "Description", "0-0": "content", "0-1": "Yes", "0-2": "User Name: [%firstName%] [%lastName%]", "0-3": "Plain text, such as a users' name or email address", "1-0": "fontColor", "1-1": "No", "1-3": "The hexadecimal color value for the content", "1-2": "0xFFFFFF", "2-0": "fontOpacity", "2-1": "No", "2-3": "0xFFFFFF", "2-2": "0.5", "3-0": "fontSize", "3-1": "No", "3-2": "0.5", "3-3": "Value between 0 and 1. The ensure that watermark text is place within the frame of the video, the font size is relative to the width of the video. For most videos a font size between 0.05 and 0.15 is reasonable.", "4-0": "x", "4-1": "No", "4-2": "0.5", "4-3": "Relative horizontal position of the text. The position is relative to the size of the video. So, an x value of 0.5 will position the text in the horizontal center of the video.", "5-0": "y", "5-1": "No", "5-2": "0.5", "5-3": "Relative vertical position of the text. The position is relative to the size of the video. So, a y value of 0.5 will position the text in the vertical center of the video.", "6-0": "align", "6-1": "No", "6-2": "CENTER\nLEFT\nRIGHT", "6-3": "Relative horizontal position of the text. The position is relative to the size of the video. So, an x value of 0.5 will position the text in the horizontal center of the video.", "7-0": "verticalAlign", "7-1": "No", "7-2": "TOP\nCENTER\nBOTTOM", "7-3": "Relative vertical position of the text. The position is relative to the size of the video. So, a y value of 0.5 will position the text in the vertical center of the video.", "8-0": "shadowColor", "9-0": "shadowOffsetX", "10-0": "shadowOffsetY", "11-0": "shadowOpacity", "8-1": "No", "8-2": "0x000000", "9-1": "No", "10-1": "No", "11-1": "No", "9-2": "0.08", "10-2": "0.08", "11-2": "0.33333334", "8-3": "The hexadecimal color value for the shadow", "9-3": "Percentage offset from the main text", "10-3": "Percentage offset from the main text", "11-3": "Opacity of the shadow, value between 0-1." }, "cols": 4, "rows": 12 } [/block] **Advanced Settings:** [block:code] { "codes": [ { "code": "{\n \t\"name\": \"A brand new template\",\n \t\"description\": \"Here, we can describe our new template\",\n \"settings\": [\n {\n \"content\": \"[%firstName%] [%lastName%]\",\n \"fontColor\": \"FFFFFF\",\n \"y\": 0.02,\n \"x\": 0.02,\n \"fontOpacity\": 0.5,\n \"fontSize\": 0.04,\n \"align\": \"LEFT\",\n \"verticalAlign\": \"TOP\",\n \"shadowColor\": \"000000\",\n \"shadowOffsetX\": 0.08,\n \"shadowOffsetY\": 0.08,\n \"shadowOpacity\": 0.33\n },\n {\n \"content\": \"ACME Studios\",\n \"fontColor\": \"FFFFFF\",\n \"y\": 0.02,\n \"x\": 0.98,\n \"fontOpacity\": 0.5,\n \"fontSize\": 0.04,\n \"align\": \"RIGHT\",\n \"verticalAlign\": \"TOP\",\n \"shadowColor\": \"000000\",\n \"shadowOffsetX\": 0.08,\n \"shadowOffsetY\": 0.08,\n \"shadowOpacity\": 0.33\n },\n {\n \"content\": \"PROPERTY OF ACME\",\n \"fontColor\": \"FFFFFF\",\n \"y\": 0.5,\n \"x\": 0.5,\n \"fontOpacity\": 0.1,\n \"fontSize\": 0.1,\n \"align\": \"CENTER\",\n \"verticalAlign\": \"MIDDLE\",\n \"shadowColor\": \"000000\",\n \"shadowOffsetX\": 0.08,\n \"shadowOffsetY\": 0.08,\n \"shadowOpacity\": 0.33\n },\n {\n \"content\": \"DO NOT DISTRIBUTE\",\n \"fontColor\": \"FFFFFF\",\n \"y\": 0.96,\n \"x\": 0.98,\n \"fontOpacity\": 0.5,\n \"fontSize\": 0.04, \n \"align\": \"RIGHT\",\n \"verticalAlign\": \"MIDDLE\",\n \"shadowColor\": \"000000\",\n \"shadowOffsetX\": 0.08,\n \"shadowOffsetY\": 0.08,\n \"shadowOpacity\": 0.33\n } \n ]\n}\n", "language": "json" } ] } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}