CreateTemplate
Creates a template in the Cases domain. This template is used to define the case object model (that is, to define what data can be captured on cases) in a Cases domain. A template must have a unique name within a domain, and it must reference existing field IDs and layout IDs. Additionally, multiple fields with same IDs are not allowed within the same Template. A template can be either Active or Inactive, as indicated by its status. Inactive templates cannot be used to create cases.
Other template APIs are:
Request Syntax
POST /domains/domainId/templates HTTP/1.1
Content-type: application/json
{
   "description": "string",
   "layoutConfiguration": { 
      "defaultLayout": "string"
   },
   "name": "string",
   "requiredFields": [ 
      { 
         "fieldId": "string"
      }
   ],
   "rules": [ 
      { 
         "caseRuleId": "string",
         "fieldId": "string"
      }
   ],
   "status": "string"
}URI Request Parameters
The request uses the following URI parameters.
- domainId
- 
               The unique identifier of the Cases domain. Length Constraints: Minimum length of 1. Maximum length of 500. Required: Yes 
Request Body
The request accepts the following data in JSON format.
- description
- 
               A brief description of the template. Type: String Length Constraints: Minimum length of 0. Maximum length of 255. Required: No 
- layoutConfiguration
- 
               Configuration of layouts associated to the template. Type: LayoutConfiguration object Required: No 
- name
- 
               A name for the template. It must be unique per domain. Type: String Length Constraints: Minimum length of 1. Maximum length of 100. Pattern: .*[\S]Required: Yes 
- requiredFields
- 
               A list of fields that must contain a value for a case to be successfully created with this template. Type: Array of RequiredField objects Array Members: Minimum number of 0 items. Maximum number of 100 items. Required: No 
- rules
- 
               A list of case rules (also known as case field conditions) on a template. Type: Array of TemplateRule objects Array Members: Minimum number of 0 items. Maximum number of 50 items. Required: No 
- status
- 
               The status of the template. Type: String Valid Values: Active | InactiveRequired: No 
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
   "templateArn": "string",
   "templateId": "string"
}Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- templateArn
- 
               The Amazon Resource Name (ARN) of the newly created template. Type: String Length Constraints: Minimum length of 1. Maximum length of 500. 
- templateId
- 
               A unique identifier of a template. Type: String Length Constraints: Minimum length of 1. Maximum length of 500. 
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
- 
               You do not have sufficient access to perform this action. HTTP Status Code: 403 
- ConflictException
- 
               The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details. HTTP Status Code: 409 
- InternalServerException
- 
               We couldn't process your request because of an issue with the server. Try again later. - retryAfterSeconds
- 
                        Advice to clients on when the call can be safely retried. 
 HTTP Status Code: 500 
- ResourceNotFoundException
- 
               We couldn't find the requested resource. Check that your resources exists and were created in the same AWS Region as your request, and try your request again. - resourceId
- 
                        Unique identifier of the resource affected. 
- resourceType
- 
                        Type of the resource affected. 
 HTTP Status Code: 404 
- ServiceQuotaExceededException
- 
               The service quota has been exceeded. For a list of service quotas, see Amazon Connect Service Quotas in the Amazon Connect Administrator Guide. HTTP Status Code: 402 
- ThrottlingException
- 
               The rate has been exceeded for this API. Please try again after a few minutes. HTTP Status Code: 429 
- ValidationException
- 
               The request isn't valid. Check the syntax and try again. HTTP Status Code: 400 
Examples
Request and Response example
This example illustrates one usage of CreateTemplate.
{ "name": "Shipping", "layoutConfiguration": { "defaultLayout": "[layout_id]" }, "requiredFields": [ { "fieldId": "[field_id]" } ] "description": "This is an example template for shipping issues", "status": "Inactive" }
{ "templateArn": "arn:aws:cases:us-west-2:[account_id]:domain/[domain_id]/template/[template_id]", "templateId": "[template_id]" }
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: