GET /templates/{template_id}
1 min
GET
https://api.cmp.optimizely.com/v3/templates/{template_id}
Path Parameters
- template_idstringrequiredExampleDescription
Responses
200
- TemplateResponseExample
{ "id": "9119a313057e401189407116fcd3aa24", "is_active": true, "title": "Sample Template Title", "description": "Sample Desciption", "applicable_to": [ "campaign_brief", "task_brief", "work_request" ], "form_fields": [ { "identifier": "attachment", "label": "Attach a file...", "helper_text": "Sample helper text", "is_required": false, "is_readonly": false, "sort_order": 0, "type": "file", "type_specific_meta": null, "logic_rules": [ { "condition": { "operator": "any_of", "values": [ "4a8b901e9fd911ecbefa0242ac160019" ] }, "action": { "target_field": { "identifier": "70ca0e8a954911ecb4be0242ac160014" }, "type": "show_values", "values": [ "73e05aa2b5d311eca17f0242ac160019" ] } } ] }, { "identifier": "73e05aa2b54nda3c320242ac1d5291", "label": "Select publish destination", "helper_text": "Sample helper text", "is_required": true, "is_readonly": false, "sort_order": 1, "type": "dropdown", "type_specific_meta": { "is_multi_select": false, "choices": [ { "id": "62553abbb7def00b4e60ded5", "name": "Sample Dropdown Field Choice" } ] }, "logic_rules": [] }, { "identifier": "73e05aa2b54nda3c320242ac1d5291", "label": "Input value", "helper_text": "Sample helper text", "is_required": false, "is_readonly": false, "sort_order": 2, "type": "simple_number", "type_specific_meta": { "decimal_places": 3, "has_thousand_separator": false }, "logic_rules": [] }, { "identifier": "73e05aa2b54nda3c320242ac1d5291", "label": "Input value", "helper_text": "Sample helper text", "is_required": false, "is_readonly": false, "sort_order": 3, "type": "percentage_number", "type_specific_meta": { "decimal_places": 3 }, "logic_rules": [] }, { "identifier": "73e05aa2b54nda3c320242ac1d5291", "label": "Input value", "helper_text": "Sample helper text", "is_required": false, "is_readonly": false, "sort_order": 4, "type": "currency_number", "type_specific_meta": { "decimal_places": 2, "currency_code": "USD", "has_thousand_separator": true }, "logic_rules": [] }, { "identifier": "73e05aa2b54nda3c320242ac1d5291", "label": "Input value", "helper_text": "Sample helper text", "is_required": false, "is_readonly": false, "sort_order": 5, "type": "richtext", "type_specific_meta": null, "logic_rules": [] }, { "identifier": "73e05aa2b54nda3c320242ac1d5291", "label": "Another section", "helper_text": "Sample helper text", "is_required": false, "is_readonly": true, "sort_order": 5, "type": "section", "type_specific_meta": null, "logic_rules": [] }, { "identifier": "73e05aa2b54nda3c320242ac1d5291", "label": "select value", "helper_text": "Sample helper text", "is_required": false, "is_readonly": false, "sort_order": 7, "type": "radio_button", "type_specific_meta": { "is_multi_select": false, "choices": [ { "id": "62553abbb7def00b4e60ded5", "name": "Sample MultiChoice Field Choice" } ] }, "logic_rules": [] }, { "identifier": "73e05aa2b54nda3c320242ac1d5291", "label": "select value", "helper_text": "Sample helper text", "is_required": false, "is_readonly": false, "sort_order": 8, "type": "label", "type_specific_meta": { "is_multi_select": false, "choices": [ { "id": "9119a313057e401189407116fcd3", "name": "Sample Label" } ] }, "logic_rules": [] } ] }- objectBaseTemplateResponse
- idstringrequiredExampleDescription
- is_activebooleanrequiredExampleDescription
- titlestringrequiredExampleDescription
- descriptionstringrequiredExampleDescription
- applicable_tostring[]requiredDescription
- object
- form_fieldsTemplateInstructionFormField[]requiredDescription
- BaseTemplateFormField
- identifierstringrequiredExampleDescription
- labelstringrequiredExampleDescription
- helper_textstringrequiredExampleDescription
- is_requiredbooleanrequiredDescription
- is_readonlybooleanrequiredDescription
- is_protectedbooleanDescription
- sort_orderintegerrequiredDescription
- typestring<brief | checkbox | currency_number | date | dropdown | file | instruction | label | percentage_number | radio_button | richtext | section | simple_number | text | text_area>requiredExampleDescriptionAllowedbriefcheckboxcurrency_numberdatedropdownfileinstructionlabelpercentage_numberradio_buttonrichtextsectionsimple_numbertexttext_area
- object
- type_specific_metaobjectrequiredDescription
- descriptionstringrequiredExampleDescription
- logic_rulesTemplateLogicRulerequiredDescription
- linksobjectrequiredDescription
- selfstringrequiredExampleDescription
401
- ErrorExample
{ "message": "Unauthorized" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
403
- ErrorExample
{ "message": "You do not have the permission to perform this operation" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
404
- ErrorExample
{ "message": "Resource not found" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
curl
curl --request GET \
--url https://api.cmp.optimizely.com/v3/templates/{template_id} \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.cmp.optimizely.com/v3/templates/{template_id}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.cmp.optimizely.com/v3/templates/{template_id}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.cmp.optimizely.com/v3/templates/{template_id}"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
200
// Fetched template
{
"id": "9119a313057e401189407116fcd3aa24",
"is_active": true,
"title": "Sample Template Title",
"description": "Sample Desciption",
"applicable_to": [
"work_request"
],
"form_fields": {},
"links": {
"self": "https://api.cmp.optimizely.com/v3/templates/9119a313057e401189407116fcd3aa24"
}
}401
// Authorization error
{
"message": "Not found",
"errors": ""
}403
// Permission error
{
"message": "Not found",
"errors": ""
}404
// Not found error
{
"message": "Not found",
"errors": ""
}