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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
Content-Type: application/xml
Content-Length: length

<CreateOrUpdateTemplateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/tvpl.api.ServiceModel">
  <Description>String</Description>
  <DocumentIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </DocumentIds>
  <Elements>
    <DocumentElementDto>
      <CreatedAt xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0001-01-01T00:00:00</CreatedAt>
      <DataType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</DataType>
      <Description xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Description>
      <ElementKey xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</ElementKey>
      <Id xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</Id>
      <IsRequired xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">false</IsRequired>
      <OrderIndex xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</OrderIndex>
      <ParentId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</ParentId>
      <Tag xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Tag>
      <TemplateId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</TemplateId>
      <TemplateType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</TemplateType>
      <Title xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Title>
      <Children>
        <DocumentElementDto>
          <CreatedAt xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0001-01-01T00:00:00</CreatedAt>
          <DataType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</DataType>
          <Description xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Description>
          <ElementKey xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</ElementKey>
          <Id xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</Id>
          <IsRequired xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">false</IsRequired>
          <OrderIndex xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</OrderIndex>
          <ParentId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</ParentId>
          <Tag xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Tag>
          <TemplateId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</TemplateId>
          <TemplateType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</TemplateType>
          <Title xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Title>
          <Children>
            <DocumentElementDto>
              <CreatedAt xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0001-01-01T00:00:00</CreatedAt>
              <DataType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</DataType>
              <Description xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Description>
              <ElementKey xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</ElementKey>
              <Id xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</Id>
              <IsRequired xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">false</IsRequired>
              <OrderIndex xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</OrderIndex>
              <ParentId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</ParentId>
              <Tag xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Tag>
              <TemplateId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</TemplateId>
              <TemplateType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</TemplateType>
              <Title xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Title>
              <Children i:nil="true" />
            </DocumentElementDto>
          </Children>
        </DocumentElementDto>
      </Children>
    </DocumentElementDto>
  </Elements>
  <Id>0</Id>
  <IsActive>false</IsActive>
  <Title>String</Title>
</CreateOrUpdateTemplateRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CreateDocumentTemplateResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/tvpl.api.ServiceModel">
  <Code>0</Code>
  <InsertedId>0</InsertedId>
  <Message>String</Message>
</CreateDocumentTemplateResponse>