Cloud Software Group, Inc. EBX®
Documentation > Developer Guide > REST data services > JSON Formats
Navigation mode Documentation > Developer Guide > REST data services > JSON Formats

# Compact

## Introduction

The JSON compact format purpose is to retrieve the master data using a lightweight structure. It follows the key-value design to display data in the simplest way and without any technical information. To activate the compact format, the `compact` suffixed REST category, like `data-compact` or `form-data-compact`, must be used in URL.

## Global structure

### JSON Request body

The request body is represented by a JSON `Object` whose content varies according to the operation and the category.

#### Data category

- Dataset node

  Specifies the target values of terminal nodes under the specified node. This request is used for the dataset node update operation.

      {
        "nodeName1": true,
        "nodeName2": 2,
        "nodeName3": "Hello"
      }

  To ensure a JSON symmetric structure between the HTTP request and the HTTP response, enumeration node request format is like the following:

      {
        "enumerationNode": {
          "key": "a key value"
        }
      }

  ##### See also

  - Update operation

- Record

  Specifies the target record content by setting the value of each field. For missing fields, the behavior depends on the request parameter `byDelta`. This structure is used for table record insert, record update or selector's select operation when local enumeration dependency field values are declared.

      {
        "gender": {
          "key": "M"
        },
        "lastName": "Chopin",
        "lastName-en": "Chopin",
        "firstName": "Fryderyk",
        "firstName-en": "Frédéric",
        "birthDate": "1810-03-01",
        "deathDate": "1849-10-17",
        "jobs": [
          {
            "key": "CM"
          },
          {
            "key": "PI"
          }
        ],
        "infos": [
          "https://en.wikipedia.org/wiki/Chopin"
        ]
      }

  ##### See also

  - Insert operation
  - Update operation

- Record fields

  Specifies the target values of fields under the record terminal node by setting the value of each field. For missing fields, the behavior depends on the request parameter `byDelta`. This structure is only used for table record updates.

      {
        "jobs": [
          {
            "key": "CM"
          },
          {
            "key": "PI"
          }
        ]
      }

  ##### See also

  - Update operation

- Record table

  Defines the content of one or more records by indicating the value of each field. For missing fields, the behavior depends on the parameter of the request `byDelta`. This structure is used upon insert or update records in the table.

      [
        {
          "gender": {
            "key": "M"
          },
          "lastName": "Saint-Saëns",
          "firstName": "Camille",
          "birthDate": "1835-10-09",
          ...
        },
        {
          "gender": {
            "key": "M"
          },
          "lastName": "Debussy",
          "firstName": "Claude",
          "birthDate": "1862-10-22",
          ...
        }
      ]

  ##### See also

  - Insert operation
  - Update operation

- Record table to delete

  Defines one or more records. This structure is used upon deleting several records from the same table.

      [
        {
          "details": "http://.../root/table/1"
        },
        {
          "details": "http://.../root/table/2"
        },
        {
          "primaryKey": "./oid=3"
        },
        {
          "foreignKey": "4"
        },
        ...
      ]

  ##### See also

  - Delete operation

- Field

  Specifies the target field content. This request is used upon field update.

  The request has the same structure as defined in node value.

  ##### See also

  - Update operation

- Open or close user interface

  Specifies whether the user interface is open or close and the unavailability message.

      {
        "toolStatus": {
          "key": true,     // or false
          "label": "Open"
        },
        "toolStatusCloseMessage": "Access is temporarily forbidden for maintenance."
      }

  ##### See also

  - User interface operations

Only writable fields can be mentioned in the request, this excludes the following cases:

- Association node,

- Selection node,

- Value function,

- JavaBean field that does not have a setter,

- Unwritable permission on node for the authenticated user.

### JSON Response body

The response body is represented by a JSON `Object` whose content depends on the operation and the category.

#### Data category

- Dataset tree

  Contains the hierarchy of `table` and non-terminal `group` nodes.

      {
        "hasChildren": false,
        "rootName": {
          "settings": {
            "weekTimeSheet": {},
            "vacationRequest": {}
          },
          "table1": {},
          "table2": {}
        }
      }

  ##### See also

  - Select operation

- Dataset node

  Contains the list of terminal nodes under the specified node.

      {
        "nodeName1": true,
        "nodeName2": 2,
        "nodeName3": "Hello"
      }

  ##### See also

  - Select operation

- Datasets list

  JSON `Object` containing the list of root or children datasets for the respectively specified dataspace or dataset.

  Every dataset JSON `Object` has the following properties:

  JSON property | JSON format | Description | Required
  --- | --- | --- | ---
  `key` | `String` | Specifies the dataset formatted key. Format: `[a-zA-Z_][-a-zA-Z0-9_.]*` | Yes
  `isSelectAllowed` | `Boolean` | Specifies whether the dataset can be selected, according to the user's permissions. | Yes
  `hasChildren` | `Boolean` | Specifies whether the dataset has children, according to the user's permissions. | Yes

      {
        "rows": [
          {
            "key": "mydataset",
            "isSelectAllowed": true,
            "hasChildren": true
          },
          {
            // Another dataset
          }
        ],
        "pagination": {
          "firstPage": "http://.../data/v1/BReference?pageSize=4",
          "nextPage": "http://.../data/v1/BReference?pageSize=4&firstElementIndex=4",
          "previousPage": null,
          "lastPage": "http://.../data/v1/BReference?pageSize=4&firstElementIndex=8"
        }
      }

  ##### See also

  - Select datasets

- Dataset information

  JSON `Object` containing the following properties:

  JSON property | JSON format | Description | Required
  --- | --- | --- | ---
  `key` | `String` | Specifies the dataset formatted key value. Format: `[a-zA-Z_][-a-zA-Z0-9_.]*`, limited to 64 characters maximum. | Yes
  `dataModel` | JSON `Object` | Specifies the dataset schema location. Only packaged in module schemas and publications are supported. | Yes
  `module` (nested under the `dataModel` property) | `String` | Specifies the module name where the dataset schema is located. | No
  `pathInModule` (nested under the `dataModel` property) | `String` | Specifies the path in the module where the dataset schema is located. | No
  `publication` (nested under the `dataModel` property) | `String` | Specifies the publication name of the dataset schema. | No
  `dataModel` (nested under the `dataModel` property) | `String` | Specifies the data model name of the dataset schema publication. | No
  `versionName` (nested under the `dataModel` property) | `String` | Specifies the version name of the dataset schema publication. | No
  `parent` | `String` | Specifies the parent dataset formatted key value. If there is no parent, then it holds a `null` value. | Yes
  `activated` | `Boolean` | Specifies whether the dataset is activated. | Yes
  `owner` | `String` | Specifies the owner profile. | Yes
  `creator` | `String` | Specifies the creator profile. | Yes
  `creation_time` | `Date` | Specifies the creation time. | Yes
  `updater` | `String` | Specifies the updater profile. | Yes
  `update_time` | `Date` | Specifies the update time. | Yes

      {
        "key": "mydataset",
        "dataModel": {
          "module": "modulename",
          "pathInModule": "/WEB-INF/ebx/schemas/mydataset.xsd"
        },
        "parent": null,
        "activated": true,
        "owner": "Beveryone",
        "creator": "Uadmin",
        "creation_time": "2023-10-10T15:49:03.023",
        "updater": "Uadmin",
        "update_time": "2023-10-10T15:49:03.005"
      }

  ##### See also

  - Select datasets

- Table

  JSON `Object` containing the following properties:

  - `rows` corresponding to JSON `Array` of selected records. Each record is represented by a JSON `Object`. If no record is selected, then the JSON `Array` is empty.

  - (Optional) `pagination` containing pagination data.

      {
        "rows": [
          {
            "id": 1,
            "firstName": "Claude",
            "lastName": "Levi-Strauss"
          },
          {
            "id": 2,
            "firstName": "Sigmoud",
            "lastName": "Freud"
          },
          {
            "id": 3,
            "firstName": "Alfred",
            "lastName": "Dreyfus"
          }
        ],
        "pagination": {
          "firstPage": null,
          "previousPage": null,
          "nextPage": "http://.../root/individu?pageRecordFilter=./id=9&pageSize=9&pageAction=next",
          "lastPage": "http://.../root/individu?pageSize=9&pageAction=last"
        }
      }

  ##### See also

  - Select operation

- Record

  JSON `Object` containing the record content.

      {
        "pk": "pk1",
        "name": "Name1",
        "name-fr": "Name1",
        "parent": null
      }

  ##### See also

  - Select operation
  - Prepare operations

- Fields

  Except for selection nodes, they contain the current node value.

  ##### See also

  - Select operation

- Retrieve the user interface state

  Contains the user interface status and the unavailability message.

      {
        "toolStatus": {
          "key": true,     // or false
          "label": "Open"
        },
        "toolStatusCloseMessage": "Access is temporarily forbidden for maintenance."
      }

  ##### See also

  - User interface operations

##### Note

Nodes, records and fields property and value may be hidden depending on their resolved permissions (see permissions) .

## Content

This section is always included and contains master data without any additional fields.

### Node value

The node value contains only the data or the label and the details link in case of enumeration. It is available for all nodes except association and selection.

### Content of simple types

Corresponds to a key-value JSON entry which describes the node content.

##### See also

- Simple types formats

### Content of group, list and enumeration

XML Schema | JSON format | Examples
--- | --- | ---
Group `xs:complexType` | `Object` Contains a property per sub-node. | Example for a simple-occurrence group.
    {
      "road": "11 rue scribe",
      "zipcode": "75009",
      "country": "France"
    }
List `maxOccurs > 1` | `Array` Contains an array of all field occurrences represented by a JSON `Object` or a simple type. Each JSON `Object` is composed of node values . | Example for a multi-occurrence field of `xs:int` type.
    [
      0,
      1,
      2,
      3,
      4
    ]
Example for a multi-occurrence group.
    [
      {
        "road": "11 rue scribe",
        "zipcode": "75009",
        "country": "France"
      },
      {
        "road": "711 Atlantic Ave",
        "zipcode": "MA 02111",
        "country": "United States"
      }
    ]
Enumeration `xs:string` | `Object` Contains `key`, `link` and `label` properties. | Example for a foreign key.
    {
      "key":"1",
      "details":"http://.../Bdataspace/dataset/root/nationality/FRA",
      "label":"Française"
    }

Documentation > Developer Guide > REST data services > JSON Formats