Please read these notes before using the document API

Which document types can be created or read

With documents API you can create or read any document type in Teamogy. Whether pre-configured document types or types that have been individually configured for you.

Pre-configured document types are:
DOCUMENT.ISSUED
DOCUMENT.RECEIVED
DOCUMENT.CONTRACT
DOCUMENT.QUOTATION.SALES
DOCUMENT.ORDER.PURCHASE
HR.DOC
ABSENCE
GEM
BINDER

Pre-configured Invoices:
INVOICE.SALES
INVOICE.SALES.PROFORMA
INVOICE.SALES.PREPAYMENT
INVOICE.SALES.CORRECTION
INVOICE.PURCHASE
INVOICE.PURCHASE.PROFORMA
INVOICE.PURCHASE.PREPAYMENT
INVOICE.PURCHASE.CORRECTION

Pre-configured Cashbox Vouchers:
CASHBOX.CREDIT
CASHBOX.DEBIT
CASHBOX.DEBIT.BILL
CASHBOX.CARD.DEBIT
CASHBOX.CARD.DEBIT.BILL

Document object structure

In the principe, the document object looks like this:

{
	// MANDATORY PART
  "type": "DOCUMENT.ORDER.PURCHASE",  // required
  "agencyId": 1,                      // required
  "ownerId": 24,                      // required
  "companyId": 30370,                 // required
     
  // OPTIONAL PART   
  "personId": null,                   // not required
  "binderId": null,                   // not required
  "number": null,                     // not required
  "tags": [],                         // not required
  "status": "PROCESSING",             // not required
  "statusDate": "2021-09-01",         // not required
  "category": "CATEGORY.ORDER-JOB",   // not required
  "properties": {},                   // not required
  "process": {},                      // not required
  "acl": {}                           // not required
  
}

Good to know about parameters:

Type
You can use pre-configured document types (see above) or configure new type. But, with API access, to be document successfully created, the type must be configured first.

Unit ID
As you know, one Teamogy account is divided into Business Units. Some Teamogy clients have only one business unit used for production data (usually with id = 1) and one DEMO unit (usually with id = 2). If your Teamogy account have more business units, you can acces data of all such units, if your token have access to such unit.
Agency ID parametr defines ownership of document to its business unit

Company ID
Company ID defines document counterparty company ID

Person ID
Person ID defines document counterparty person ID

Binder ID
Binder ID defines binder document belongs into

Number
Number is registration number of the document. If you create document without this parameter, Teamogy will immediatelly number the document based on numbering rule configured for such document type. If number is defined in third party system, Teamogy will accept this number, but this number has to be unique (not used for another previously created document)

Tags
Tags is array of strings, which can be defined to easily find created document

Status
Status of document. The status has to be choosen from existing pre-configured statuses in Teamogy or you can configure your own.

Status Date
This is the date, when document receives specific status. If you omit this parameter Teamogy will set this automaticcaly.

Category
Category of document. The category has to be choosen from existing pre-configured categories in Teamogy or you can configure your own.

Properties
You can save any property to document. for example:

"properties": {
  "name": "This is subject",
  "createdOn": "2021-09-03",
  "bodyRichtext-1": "<p>This is body <strong>formatted</strong> text.</p>"
}

Process
You can define process applied on document as follows:

"process": {
  "processKey":"PROCESS-INVOICE.SALES"
}

ACL
Access defined in this object is CUSTOM acces which is applied over the AUTOMATIC access which is defined in Teamogy configuration for appropriate document type. If you do not define acl object, only automatic access will be generated on created document. For example:

"acl": {
  "custom": {
    "read": {
      "users": [24,18],
      "groups": [232]
    },
      "write": {
        "users": [50,55],
        "groups": [223,224]
      }
  }
}

Rights to access document

For accessing the document, your token must have rights to read such document. Every token is generated for specific user. It can be real registered user, or programmatic access user. But the ability to read specific document is dependant if such user has right to access such document.