Single Record Update APIAPI Explorer

Introduction

API Introduction

You can update one record in a certain form through the API.

Note: When you use API to create records, the following events will be triggered: notifications for submitted records, aggregation table calculation & validation, data operation log recording, and data volume statistics. It is also possible to control whether to initiate a workflow through request parameters. However, duplicate value and required field validations will not be triggered.

The records in the system fields and the following fields cannot be added or updated.

  • Divider
  • Signature
  • RelatedData and RelatedQuery
  • Serial No. (Automatically generated)

API Calling

Update the data in the form according to the specified data ID.

Request URL: https://api.jodoo.com/api/v5/app/entry/data/update

Request Frequency: 20 times per second

Request Method: POST

Request Parameters:

Parameter

Type

Required

Description

Default

app_id

String

Yes

App ID

/

entry_id

String

Yes

Form ID

/

data_id

String

Yes

Data ID

/

data

JSON

Yes

Data content. If the form is a subform, the subform data ID needs to be indicated in the data content, and other content is the same as the Create one record API.

/

is_start_trigger

Bool

No

Whether to trigger Automations

false

transaction_id

String

No

Transaction ID; transaction_id is used to bind a batch of uploaded files. If the data includes attachments or image controls, the transaction_id must be the same as the transaction_id parameter in Accessing File Upload Credentials and URLs API.

/

Sample Request:

{
   "app_id": "604eb6eea71d720006e1336e",
   "entry_id": "604ecfca8e2ade077c72453a",
  "transaction_id": "87cd7d71-c6df-4281-9927-469094395677",   // Transaction ID
    "data_id": "6052e8072315c0075001d65e",
    "data": {
        "_widget_1615777739654": {
            "value": "Karl"
        },
        "_widget_1615777739673": {
            "value": [
                {    
                    "_widget_1615777739744": {   // No subform data ID passed
                        "value": "Karl"
                    }
                },
                {
                    "_id": {
                        "value": "606290aba392ca00076da000"   // Incorrect subform data ID passed
                    },
                    "_widget_1615777739744": {
                        "value": "Charles"
                    }
                },
                {
                    "_id": {
                        "value": "606290aba392ca00076da0a9"     // Correct subform data ID
                    },
                    "_widget_1615777739744": {
                        "value": "Ben"
                    }
                }
            ]
        }
    },
    "is_start_trigger": true
}

Sample Response:

Parameter

Type

Description

data

JSON

Return the updated records, with the same content as the Query one record API.

Response Example:

{
    "data": {
        "creator": {
            "name": "David",
            "username": "david",
            "status": 1,
            "type": 0,
            "departments": [1, 3],
            "integrate_id": "david"
        },
        "updater": {
            "name": "David",
            "username": "david",
            "status": 1,
            "type": 0,
            "departments": [1, 3],
            "integrate_id": "david"
        },
        "deleter": null,
        "createTime": "2021-03-18T05:41:27.760Z",
        "updateTime": "2021-03-30T02:46:21.563Z",
        "deleteTime": null,
        "_widget_1615777739654": "Charles",
        "_widget_1616052516346": "",
        "_widget_1615777739673": [
            {
                "_id": "606290fd0094210006e97551",   // New subform data ID generated when no subform data ID is passed
                "_widget_1615777739744": "Karl"
            },
            {
                "_id": "606290fd0094210006e97552",   // New subform data ID generated when incorrect subform data ID is passed
                "_widget_1615777739744": "Charles"
            },
            {
                "_id": "606290aba392ca00076da0a9",   // Correct subform data ID passed and unchanged
                "_widget_1615777739744": "Ben"
            }
        ],
        "_id": "6052e8072315c0075001d65e",
        "appId": "604eb6eea71d720006e1336e",
        "entryId": "604ecfca8e2ade077c72453a",
    }
}

Notes

1. If you do not pass the subform data ID or pass it incorrectly when calling the API, the API will clear the original subform data and replace it with the new subform data passed in the request. The API will also generate new data IDs for subform data whose data ID is not passed or passed incorrectly. If you pass the correct subform data ID, the data ID will remain unchanged. This means the API will reset the subform data ID that is not passed or passed incorrectly each time it is called. Meanwhile, a "Subform Changed" record will be logged to the data management log, even if the subform content has not changed.

2. When you use the API, you cannot update a specific row of data in the subform by specifying the subform data ID. Instead, you need to pass the entire subform data structure along with the changes you want to make. For example, if there are originally three rows of data in the subform, and you only pass two rows in the request parameters, even if the subform row IDs are passed correctly, the updated subform data will only have two rows.

If you are having difficulty understanding the first note, the following example may help:

Assuming that there are three rows of data in the original subform with the following structure:

{
    "_id": "605b5f68255d4845a73d3c0a",  // <= Data ID
    "_widget_1616600963783": "Single Line",
    "_widget_1616600980550": [{
        "_id": "605b5fa6255d4845a73d3c0b", // <= Subform data ID
        "_widget_1616601008197": "Value of Single Line 1 in the subform"
    }, {
        "_id": "605b5fdc255d4845a73d3c0c", // <= Subform data ID
        "_widget_1616601008197": "Value of Single Line 2 in the subform"
    }, {
        "_id": "605b5fdc255d4845a73d3c0d", // <= Subform data ID
        "_widget_1616601008197": "Value of Single Line 3 in the subform"
    }]
}

Assuming that there is one incorrect subform data ID passed, one not passed, and one passed correctly when you call the v3/v4/v5 API, the request parameters are as follows:

{
    "data_id": "605b5f68255d4845a73d3c0a", // <= Data ID
    "data": {
        "_widget_1616600963783": {
            "value": "Single Line Changed"
        },
        "_widget_1616600980550": {
            "value": [{
                                                            // <= No subform data ID passed
                "_widget_1616601008197": {
                    "value": "Updated value of Single Line 1 in the subform"
                }
            }, {
                "_id": {
                    "value": "jodoo" // <= Incorrect subform data ID passed
                },
                "_widget_1616601008197": {
                    "value": "Updated value of Single Line 2 in the subform"
                }
            }, {
                "_id": {
                    "value": "605b5fdc255d4845a73d3c0d" // <= Correct subform data ID passed
                },
                "_widget_1616601008197": {
                    "value": "Updated value of Single Line 3 in the subform"
                }
            }]
        },
    //... other parameters
    }    
}

The updated data structure is as follows, with the data IDs of the first and second row in the subform changed:

{
    "_id": "605b5f68255d4845a73d3c0a",  // <= Data ID
    "_widget_1616600963783": "Single Line",
    "_widget_1616600980550": [{
        "_id": "605b5fa6255d4845a73d3c0e", // <= Newly generated subform data ID
        "_widget_1616601008197": "Updated value of Single Line 1 in the subform"
    }, {
        "_id": "605b5fdc255d4845a73d3c0f", // <= Newly generated subform data ID
        "_widget_1616601008197": "Updated value of Single Line 2 in the subform"
    }, {
        "_id": "605b5fdc255d4845a73d3c0d", // <= Subform data ID unchanged
        "_widget_1616601008197": "Updated value of Single Line 3 in the subform"
    }]
}

Was this information helpful?
Yes
NoNo
Need more help? Contact support