Data types

When working with APIs, ELMA365 sends a request to a third-party service and receives a response containing the requested data. APIs work 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

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: a value in a minimum coin (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 (only ten-digit numbers) (string)

Example:

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

Email address

JSON objects array data type

Object fields:

  • type: email type (string)
  • email: email address (only significant characters) (string)

Example:

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

Image

JSON strings array data type

Values are image files IDs in the system

Example:

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

Files

JSON strings array data type

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 that has just been uploaded, you need to pass the file object with the “name” and “hash” fields.

Example:

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

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

Example:

{
    "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.

Example:

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

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

Example:

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

When working with files, their copies are created in apps. If you need to edit a file, do so within the app, as editing the original file in the “Files” workspace will not change the file in the app.

Full Name

JSON object data type

Object fields:

  • lastname: last name
  • firstname: first name
  • middlename: middle name

Example:

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

Link

JSON string data type

Example:

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

Users

JSON strings array data type

Values are users IDs

Example:

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

App

JSON strings array data type

Values are app items IDs

Example:

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

Table

JSON object data type

Object fields:

  • rows: strings array. Each string is an object whose fields are determined when configuring the table. Keys are the field codes whose values depend on their type. 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"
    }  
}