Data types

When working with the API, the system sends a request to a third-party service and receives a response containing the requested data. The API works with the following data types:

String

JSON string data type

Example:

{
    "key": "example"
}

Number

JSON number data type

Example:

{
    "key": 10
}

Yes/No switch

JSON boolean data type

Example:

{
    "key": true
}

Date/Time

JSON string data type

The value needs to be in the RFC3339 format.

Example:

{
    "key": "2006-01-02T15:04:05Z07:00"
}

Category

JSON objects array data type

Object fields:

  • code. Category code (string).
  • name. Category name (string).

Example:

{
    "key": [ { "code": "example", "name": "Example"} ]
}

Money

JSON object data type

Object fields:

  • cents. The value in a minimum coin, for example, cent, euro cent, kopeck (number).
  • currency. The currency (string).

Example:

{
    "cents": 1000,
    "currency": "RUB"
}

Phone number

JSON objects array data type

Object fields:

  • type. Phone number type (string).
  • tel. Phone number including only significant digits (string)

Example:

{
    "key": [ { "type":"home", "tel":"+190000000000" } ]
}

Email address

JSON objects array data type

Object fields:

  • type. Email type (string).
  • email. Email address including only significant characters (string).

Example:

{
    "key": [ { "type":"home", "email":"example@email.com" } ]
}

Image

JSON strings array data type

The values are image files’ IDs in the system.

Example:

{
    "key": [ "c44b66f6-216a-457e-a37e-ea8e373a4b77" ]
}

Files

JSON strings array data type

The values are files’ IDs in the system.

Example:

{
    "key": [ "c44b66f6-216a-457e-a37e-ea8e373a4b77" ]
}

Work with files in processes and apps

To add a temporary file, you need to pass the file object with the name and hash fields:

{
    "document":[
        {
            "name":"file.docx",
            "hash":"e2949784-85a9-403e-9aa7-e222b4572082"
        }
    ]
}

If there are several files, the objects are separated by comma:

{
    "document":[
        {
            "name":"file1.docx",
            "hash":"e2949784-85a9-403e-9aa7-e222b4572082"
        },
        {
            "name":"file2.docx",
            "hash":"120ae172-2ec0-47bd-a923-0de3ca40ee24"
        }
    ]
}

To add an existing file (a file that has been initialized and is stored in the Files workspace), you need to pass the file’s ID:

{
    "document":[
        "444de6ec-84dc-489b-9273-23755860cab4"
    ]
}

If there are several files, their IDs are separated by comma:

{
    "document":[
        "ed7bde6a-ae8b-4e39-96a0-985f59bfda19",
        "444de6ec-84dc-489b-9273-23755860cab4"
    ]
}

Note that when you work with files in apps, you actually work with their copies. If you need to edit a file, do so directly in the app. If you edit the original file in the Files workspace, the file in the app won’t change.

Full Name

JSON object data type

Object fields:

  • lastname. Last name.
  • `firstname. First name.
  • middlename. Middle name.

Example:

{
    "key": {
        "lastname": "Smith",
        "firstname": "Sarah",
        "middlename": "Ellen"
    }
}

Link

JSON string data type

Example:

{
    "key": "http://site.org"
}

Users

JSON strings array data type

The values are users’ IDs.

Example:

{
    "key": [ "c44b66f6-216a-457e-a37e-ea8e373a4b77" ]
}

App

JSON strings array data type

The values are app items’ IDs.

Example:

{
    "key": [ "c44b66f6-216a-457e-a37e-ea8e373a4b77" ]
}

Table

JSON object data type

Object fields:

  • rows. An array of strings. Each string is an object whose fields are determined when configuring the table. Keys are the field codes whose values depend on the fields’ types. If the column value is specified by a formula, it is calculated automatically.
  • result. This is the result object whose fields are defined when configuring the table. Only columns for which the result (value in the footer) is calculated by a formula will be included into this object. This object is calculated automatically based on the column settings.
  • view. This is the string representation of the table formed by a template. The view is generated automatically.

Example:

{
    "key" : {
        "rows": [
            {  "good_name" : "product 1", "count" : 10},
            {  "good_name" : "product 2", "count" : 20},
        ],
        "result": { "count": 30 },
        "view": "Total: 30 items"
    }  
}