tvpl.api

<back to all web services

CreateOrUpdateTemplateRequest

Requires Authentication
Required role:super-admin
The following routes are available for this service:
POST/document-template
import java.math.*;
import java.util.*;
import net.servicestack.client.*;

public class dtos
{

    public static class CreateOrUpdateTemplateRequest
    {
        public Integer id = null;
        public ArrayList<Integer> documentIds = null;
        public String title = null;
        public String description = null;
        public Boolean isActive = null;
        public ArrayList<DocumentElementDto> elements = null;
        
        public Integer getId() { return id; }
        public CreateOrUpdateTemplateRequest setId(Integer value) { this.id = value; return this; }
        public ArrayList<Integer> getDocumentIds() { return documentIds; }
        public CreateOrUpdateTemplateRequest setDocumentIds(ArrayList<Integer> value) { this.documentIds = value; return this; }
        public String getTitle() { return title; }
        public CreateOrUpdateTemplateRequest setTitle(String value) { this.title = value; return this; }
        public String getDescription() { return description; }
        public CreateOrUpdateTemplateRequest setDescription(String value) { this.description = value; return this; }
        public Boolean getIsActive() { return isActive; }
        public CreateOrUpdateTemplateRequest setIsActive(Boolean value) { this.isActive = value; return this; }
        public ArrayList<DocumentElementDto> getElements() { return elements; }
        public CreateOrUpdateTemplateRequest setElements(ArrayList<DocumentElementDto> value) { this.elements = value; return this; }
    }

    public static class DocumentElementDto extends DocumentElement
    {
        public ArrayList<DocumentElementDto> children = null;
        
        public ArrayList<DocumentElementDto> getChildren() { return children; }
        public DocumentElementDto setChildren(ArrayList<DocumentElementDto> value) { this.children = value; return this; }
    }

    public static class DocumentElement
    {
        public Integer id = null;
        public Integer templateId = null;
        @Required()
        public String elementKey = null;

        @Required()
        public String tag = null;

        public Integer parentId = null;
        @Required()
        public String title = null;

        public String description = null;
        @Required()
        public String dataType = null;

        public String templateType = null;
        public Integer orderIndex = null;
        public Boolean isRequired = null;
        
        public Integer getId() { return id; }
        public DocumentElement setId(Integer value) { this.id = value; return this; }
        public Integer getTemplateId() { return templateId; }
        public DocumentElement setTemplateId(Integer value) { this.templateId = value; return this; }
        public String getElementKey() { return elementKey; }
        public DocumentElement setElementKey(String value) { this.elementKey = value; return this; }
        public String getTag() { return tag; }
        public DocumentElement setTag(String value) { this.tag = value; return this; }
        public Integer getParentId() { return parentId; }
        public DocumentElement setParentId(Integer value) { this.parentId = value; return this; }
        public String getTitle() { return title; }
        public DocumentElement setTitle(String value) { this.title = value; return this; }
        public String getDescription() { return description; }
        public DocumentElement setDescription(String value) { this.description = value; return this; }
        public String getDataType() { return dataType; }
        public DocumentElement setDataType(String value) { this.dataType = value; return this; }
        public String getTemplateType() { return templateType; }
        public DocumentElement setTemplateType(String value) { this.templateType = value; return this; }
        public Integer getOrderIndex() { return orderIndex; }
        public DocumentElement setOrderIndex(Integer value) { this.orderIndex = value; return this; }
        public Boolean getIsRequired() { return isRequired; }
        public DocumentElement setIsRequired(Boolean value) { this.isRequired = value; return this; }
    }

    public static class CreateDocumentTemplateResponse implements IResponseRequest
    {
        public Integer insertedId = null;
        public Integer code = null;
        public String message = null;
        
        public Integer getInsertedId() { return insertedId; }
        public CreateDocumentTemplateResponse setInsertedId(Integer value) { this.insertedId = value; return this; }
        public Integer getCode() { return code; }
        public CreateDocumentTemplateResponse setCode(Integer value) { this.code = value; return this; }
        public String getMessage() { return message; }
        public CreateDocumentTemplateResponse setMessage(String value) { this.message = value; return this; }
    }

}

Java CreateOrUpdateTemplateRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /document-template HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	id: 0,
	documentIds: 
	[
		0
	],
	title: String,
	description: String,
	isActive: False,
	elements: 
	[
		{
			children: 
			[
				{
					children: 
					[
						{
							id: 0,
							templateId: 0,
							elementKey: String,
							tag: String,
							parentId: 0,
							title: String,
							description: String,
							dataType: String,
							templateType: String,
							orderIndex: 0,
							isRequired: False
						}
					],
					id: 0,
					templateId: 0,
					elementKey: String,
					tag: String,
					parentId: 0,
					title: String,
					description: String,
					dataType: String,
					templateType: String,
					orderIndex: 0,
					isRequired: False
				}
			],
			id: 0,
			templateId: 0,
			elementKey: String,
			tag: String,
			parentId: 0,
			title: String,
			description: String,
			dataType: String,
			templateType: String,
			orderIndex: 0,
			isRequired: False
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	insertedId: 0,
	code: 0,
	message: String
}