Creating records

API reference available here.

After you create a schema, you can save data according to that schema. Each data entry is called a record.

To add a record, you need the UUID of the schema. You can obtain it by using this endpoint (you can filter the results by schema name).

Request example

The request example creates an employee record according to the schema created in Creating schemas.

Expand to see complete curl example

curl --location --request \
POST 'https://{SYNERISE_API_BASE_PATH}/boxes-v2/records/3214aca5-d55e-4b0f-8784-e84eae291cf4' \
--header 'api-version: 4.2' \
--header 'authorization: Bearer eyJhb...Xen8' \
--header 'Content-Type: application/json' \
--data-raw '{
    "fields": {
        "isContractor": {
            "value": false
        },
        "lastName": {
            "value": "Smith"
        },
        "daysOff": {
            "value": "16.5"
        },
        "firstName": {
            "value": "John"
        },
        "employeeId": {
            "value": "LUE42"
        }
    }
}'

Note: If you are creating a record for a schema that has relations defined, the request must contain data about that relation. To learn about relations, read Schema relations.

Response

If the request was successful, the response includes the details of the record, including its UUID, used as the identifier for the record in other requests.

Expand to see complete response example

{
    "businessProfileId": 100005,
    "createdAt": "2020-10-26T13:59:26.099Z",
    "createdBy": 140,
    "deletedAt": null,
    "deletedBy": null,
    "fields": {
        "isContractor": {
            "value": false
        },
        "lastName": {
            "value": "Smith"
        },
        "daysOff": {
            "value": "16.5"
        },
        "firstName": {
            "value": "John"
        },
        "employeeId": {
            "value": "LUE42"
        }
    },
    "modifiedAt": "2020-10-26T13:59:26.099Z",
    "modifiedBy": 140,
    "recordId": "0437eced-5ec2-4662-99e3-d80c946a475b",
    "relations": {}, // included even when no relations are defined
    "schemaId": "3214aca5-d55e-4b0f-8784-e84eae291cf4"
}

Errors

If the request fails, the response provides details on what went wrong. For example, when a field in the schema is not found in the record’s JSON data:

{
    "error": "Bad Request",
    "message": "Record validation error",
    "payload": {
        "fields": {
            "employeeId": [
                "Field does not exist in record"
            ]
        }
    },
    "status": 400,
    "timestamp": "2020-09-07T09:08:36.005Z"
}

Result in GUI

The figure presents what the record looks like in the Synerise Portal, when viewing the records of the schema.

Screenshot of a record
A single record saved to a schema

Explanation

In the fields object, each object is named after a field in the schema and assigns a value to that field. The record does not reference the graphical layout of the schema in any way.

Note: Numerical values for fields are sent as strings.
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker