POST api/documents

Adds a new document template. If the CompanyId field is equal to 0, it adds a new global template. Otherwise, if the CompanyId field is equal to the AccountingOfficeId field, it adds a new accounting office-level template. Otherwise it adds an organization-level template.

Request Information

URI Parameters

None.

Body Parameters

DocumentDTO
NameDescriptionTypeAdditional information
DocumentTemplateId

Unique ID representing the document template.

integer

None.

Category

Category that the template belongs to. Use application type, such as "CPP" or "Retail".

string

None.

Name

Name of the document template. Has to be unique within the category.

string

None.

Code

Unique code for the template within the category, when referring to it programatically.

string

None.

DownloadFileName

Filename used when downloading the generated document.

string

None.

Watermark

Text for the watermark used when the watermark flag is specified.

string

None.

TemplatePath

Name of the stored document template. Must be globally unique, and can be set only when creating the template.

string

None.

DepartmentName

Name of the department.

string

None.

AccountingOfficeId

Accounting office ID of the template. Semantics may vary according to the level it applies to.

integer

None.

CompanyId

Company ID of the template. Semantics may vary according to the level it applies to.

integer

None.

DepartmentId

Department ID of the template. Semantics may vary according to the level it applies to.

integer

None.

Request Formats

application/json, text/json

Sample:
{
  "DocumentTemplateId": 1,
  "Category": "sample string 2",
  "Name": "sample string 3",
  "Code": "sample string 4",
  "DownloadFileName": "sample string 5",
  "Watermark": "sample string 6",
  "TemplatePath": "sample string 7",
  "DepartmentName": "sample string 8",
  "AccountingOfficeId": 1,
  "CompanyId": 1,
  "DepartmentId": 1
}

text/html

Sample:
{"DocumentTemplateId":1,"Category":"sample string 2","Name":"sample string 3","Code":"sample string 4","DownloadFileName":"sample string 5","Watermark":"sample string 6","TemplatePath":"sample string 7","DepartmentName":"sample string 8","AccountingOfficeId":1,"CompanyId":1,"DepartmentId":1}

application/xml, text/xml

Sample:
<DocumentDTO xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Common.WebAPI.DTOs">
  <AccountingOfficeId>1</AccountingOfficeId>
  <Category>sample string 2</Category>
  <Code>sample string 4</Code>
  <CompanyId>1</CompanyId>
  <DepartmentId>1</DepartmentId>
  <DepartmentName>sample string 8</DepartmentName>
  <DocumentTemplateId>1</DocumentTemplateId>
  <DownloadFileName>sample string 5</DownloadFileName>
  <Name>sample string 3</Name>
  <TemplatePath>sample string 7</TemplatePath>
  <Watermark>sample string 6</Watermark>
</DocumentDTO>

application/x-www-form-urlencoded

Sample:

Failed to generate the sample for media type 'application/x-www-form-urlencoded'. Cannot use formatter 'JQueryMvcFormUrlEncodedFormatter' to write type 'DocumentDTO'.

Response Information

Resource Description

DocumentDTO
NameDescriptionTypeAdditional information
DocumentTemplateId

Unique ID representing the document template.

integer

None.

Category

Category that the template belongs to. Use application type, such as "CPP" or "Retail".

string

None.

Name

Name of the document template. Has to be unique within the category.

string

None.

Code

Unique code for the template within the category, when referring to it programatically.

string

None.

DownloadFileName

Filename used when downloading the generated document.

string

None.

Watermark

Text for the watermark used when the watermark flag is specified.

string

None.

TemplatePath

Name of the stored document template. Must be globally unique, and can be set only when creating the template.

string

None.

DepartmentName

Name of the department.

string

None.

AccountingOfficeId

Accounting office ID of the template. Semantics may vary according to the level it applies to.

integer

None.

CompanyId

Company ID of the template. Semantics may vary according to the level it applies to.

integer

None.

DepartmentId

Department ID of the template. Semantics may vary according to the level it applies to.

integer

None.

Response Formats

application/json, text/json

Sample:
{
  "DocumentTemplateId": 1,
  "Category": "sample string 2",
  "Name": "sample string 3",
  "Code": "sample string 4",
  "DownloadFileName": "sample string 5",
  "Watermark": "sample string 6",
  "TemplatePath": "sample string 7",
  "DepartmentName": "sample string 8",
  "AccountingOfficeId": 1,
  "CompanyId": 1,
  "DepartmentId": 1
}

text/html

Sample:
{"DocumentTemplateId":1,"Category":"sample string 2","Name":"sample string 3","Code":"sample string 4","DownloadFileName":"sample string 5","Watermark":"sample string 6","TemplatePath":"sample string 7","DepartmentName":"sample string 8","AccountingOfficeId":1,"CompanyId":1,"DepartmentId":1}

application/xml, text/xml

Sample:
<DocumentDTO xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Common.WebAPI.DTOs">
  <AccountingOfficeId>1</AccountingOfficeId>
  <Category>sample string 2</Category>
  <Code>sample string 4</Code>
  <CompanyId>1</CompanyId>
  <DepartmentId>1</DepartmentId>
  <DepartmentName>sample string 8</DepartmentName>
  <DocumentTemplateId>1</DocumentTemplateId>
  <DownloadFileName>sample string 5</DownloadFileName>
  <Name>sample string 3</Name>
  <TemplatePath>sample string 7</TemplatePath>
  <Watermark>sample string 6</Watermark>
</DocumentDTO>