Update Record

Updates details of 1 record in an App by specifying its record number, or a different unique key.

MethodPUT
URLhttps://{subdomain}.kintone.com/k/v1/record.json
URL(guest space)https://{subdomain}.kintone.com/k/guest/{SpaceID}/v1/record.json
AuthenticationAPI Token Authentication , Password Authentication
Content-Typeapplication/json

Contents

Permissions

  • Permission to update records into the App is needed.
  • Permission to update fields that are included in the request parameters are needed.

Request Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
app Integer or String Yes The App ID.
id Integer or String Conditional The Record ID of the record to be updated. Required, if updateKey will not be specified.
updateKey Object Conditional The unique key of the record to be updated. Required, if id will not be specified. To specify this field, the field must have the “Prohibit duplicate values” option turned on.
updateKey.field String Conditional The field code of the unique key.
Required, if updateKey will be specified.
updateKey.value Integer or String Conditional The value of the unique key.
Required, if updateKey will be specified.
revision Integer or String The expected revision number. If the value does not match, an error will occur and the record will not be updated. If the value is not specified or is -1, the revision number will not be checked.
record Object Field codes and values are specified in this object. If ignored, the record will not be updated. For field type specs, check the Field Types page.

*the API will result in an error if both id and updateKey are specified

Sample Request (id)

JavaScript (using Kintone REST API Request )

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
var body = {
  'app': 1,
  'id': 1,
  'record': {
    'Text': {
      'value': 'ABC'
    }
  }
};

kintone.api(kintone.api.url('/k/v1/record', true), 'PUT', body, function(resp) {
  // success
  console.log(resp);
}, function(error) {
  // error
  console.log(error);
});

curl Sample

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
$ curl -X PUT 'https://{subdomain}.kintone.com/k/v1/record.json' \
-H 'X-Cybozu-API-Token: {APIToken}' \
-H 'Content-Type: application/json' \
-d '{
    "app": 1,
    "id": 1,
    "record": {
        "Text": {
            "value": "ABC"
        }
    }
}'

Sample Request (updateKey)

JavaScript (using Kintone REST API Request )

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
var body = {
  'app': 1,
  'updateKey': {
    'field': 'unique_key',
    'value': 'unique_code'
  },
  'record': {
    'Text': {
      'value': 'ABC'
    }
  }
};

kintone.api(kintone.api.url('/k/v1/record', true), 'PUT', body, function(resp) {
  // success
  console.log(resp);
}, function(error) {
  // error
  console.log(error);
});

curl Sample

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
$ curl -X PUT 'https://{subdomain}.kintone.com/k/v1/record.json' \
-H 'X-Cybozu-API-Token: {APIToken}' \
-H 'Content-Type: application/json' \
-d '{
    "app": 1,
    "updateKey": {
        "field": "unique_key",
        "value": "unique_code"
    },
    "record": {
        "Text": {
            "value": "ABC"
        }
    }
}'

Response Parameters

Parameter Type Description
revision String The revision number of the record.

Sample Response

1
2
3
{
  "revision": "5"
}

Attachment fields and Tables

Updating and deleting files on attachment fields

If you want to add new file to an attachment field that already has several files attached to it, you will need to specify the fileKeys of those files in the request. You cannot update a specific attachment file.
If a fileKey is not specified in the request, the files will be deleted.

Updating tables

If data of the tables are not included in the request, the table data will stay as it is.
If table data is included in the request, take note of the following:

  • All fields inside the table that are not included in the request will be deleted.
  • To keep specific data of fields in the table, the value of that field must be included in the request.
  • By specifying the ID of a table row (the ID can be retrieved by using the Get Record API), specific rows and fields can be updated.
  • If a table row ID that does not exist is specified, the row will be added as a new row. In this case, rows that exist in the table but were not specified in the API, will be deleted.

Limitations

  • If there are fields with the “Required field” option turned on and those fields hold no values (which could occur in cases where the App form was updated after some records were added to the App), those fields must be included in the request.
  • The following fields cannot be updated:
    • The Field Mappings targets of the Lookup field
    • Status
    • Categories
    • Calculated
    • Assignee
    • Record number
    • Created by
    • Created datetime
    • Updated by
    • Updated datetime
  • If fields that do not exists inside the App are specified in the requests, these fields will be ignored.
  • If Calculated fields are specified values in the request, these values will be ignored.
  • If Text fields with the “Calculate automatically” option are specified values in the request, these values will be ignored.
  • Fields specified as the updateKey cannot be updated.
  • For other limitations, please check the Limitations on this page .

Update Multiple Records

To Update data of multiple records, refet to the Update Records API article.