POST (Create) Operations

exclamation_mark_red

UniqueIds, bms_LastModified and Auto-Numbers for records created by POST

The UniqueId and any auto-number fields play a crucial role in the SAI360 system to identify individual records.

Therefore, please be aware of the following protections and considerations:

  • UniqueId & bms_LastModified:
    if either of these fields are included in the payload, they will be ignored by the Rest API, and the system will apply the usual methods to create these values.
  • Auto-Numbers: while it is possible to include and create auto-numbers via the POST statement, this approach is strongly discouraged as it carries the risk of creating
    - duplicate entries
    - gaps in the numbers.

Defining the Payload

To create a record, the call needs to include a payload, which needs to adhere to the following:

  • The payload format is to be defined as:
    • "raw" and in
    • JSON (application/json) format
  • The content is a list of key <-> value pairs, enclosed in { }. The generic format is:
    {
    "field_name": "new value for the field"
    }

    For example:

    {
    "action_description": "Please service and replace bulb if necessary"
    }

  • For field specific formats, please refer to the previous chapter.

Basic POST Operations

All the following examples assume that the base URL for the Reporting API is: http://<WebApp URL>/restapi

Supported Basic Operations

For the Task of ...

Use the following REST call (URL)

To create a single record on a given component.

CALL:

To create a single record on a component, the call is as follows:

http://<WebApp URL>/restapi/component/<component_name>

For example:

http://<WebApp URL>/restapi/component/action

PAYLOAD:

In the payload, include all the fields and values which need to be updated, for example:

{
"action_summary": "East exit emergency sign is flickering.",
"action_description": "Please service and replace bulb if necessary."
}

See Also

Rest API

Rest API - Introduction

Add Components to Rest API

Generate an API Key for a User

GET (Read) Operations

PATCH (Write) Operations

CREATE or UPDATE Users with Rest API

CREATE DBFiles/Files with Rest API