Update Action Settings

Updates the Action settings of the App. For more information on Actions, refer to the following article:
Configuring App Actions (External link)

This API updates the pre-live settings. After using this API, use the following API to deploy the settings to the live App:
Deploy App Settings

MethodPUT
URLhttps://{subdomain}.kintone.com/k/v1/preview/app/actions.json
URL(guest space)https://{subdomain}.kintone.com/k/guest/{SpaceID}/v1/app/actions.json
Authentication Password Authentication , API Token Authentication , Session Authentication
Content-Typeapplication/json

Contents

Permissions

  • App Management Permissions of the source App are needed.
  • Permissions to view the copy destination App are needed.*

* If the actions.{actionname}.destApp and actions.{actionname}.mappings parameters are omitted, permissions to view the copy destination App is not required.

Request Parameters

Parameter Type Required Description
app Integer or String Yes The App ID.
actions Object Yes An object listing Action settings.
The object's key is the Action's unique identifier, which is equal to the Action's name in its default language settings.
The values of the key are the various Action settings associated with that Action.
actions.{actionname} Object An object listing Action information of 1 Action.

If actionname is equal to the name of an existing Action, the Action will be updated with the values in the object.

If actionname is not equal to a name of an existing Action, a new Action will be created with the values in the object.

Any existing Action that is not set for this parameter will be deleted.
actions.{actionname}.name String Conditional The name of the Action.
1 to 32 characters can be specified.
When creating a new Action, the request will fail if this parameter's value is not the same as actions.{actionname}.

Required when updating an existing Action, or creating a new Action.
actions.{actionname}.index Integer or String Conditional The order of the Actions.
The Action is sorted in ascending order, starting from 0.
The request will fail if there are duplicate values.

Required when updating an existing Action, or creating a new Action.
actions.{actionname}.destApp Object Conditional An object containing the Target option that specifies the destination App where data is to be copied.

Required when creating a new Action.
actions.{actionname}.destApp.app Integer or String Conditional The App ID of the copy destination App.

Required if the actions.{actionname}.destApp.code is not specified.
actions.{actionname}.destApp.code String Conditional The App Code of the copy destination App.

Required if the actions.{actionname}.destApp.app is not specified.

If both actions.{actionname}.destApp.app and actions.{actionname}.destApp.code are specified, code takes precedence.
actions.{actionname}.mappings Array Conditional An array of objects containing the "Field Mappings" options.
If the array is empty, the Action will not have "Field Mappings" options set.

Required when specifying the actions.{actionname}.destApp parameter, or creating a new Action.
actions.{actionname}.mappings[].srcType String Conditional The type of source data that is to be copied.
  • FIELD: Data stored in the source App's field
  • RECORD_URL: The Record's permalink
Required when specifying the actions.{actionname}.mappings parameter.
actions.{actionname}.mappings[].srcField String Conditional The field code of the field specified in the "Field Mappings" options as the source.

Required when the actions.{actionname}.mappings[].srcType is set to FIELD.
actions.{actionname}.mappings[].destField String Conditional The field code of the field specified in the "Field Mappings" options as the destination.

Required when specifying the actions.{actionname}.mappings parameter.
actions.{actionname}.entities Array Conditional An array of objects containing the entities the Action is granted to.
This reflects the "Available To" options.
If the array is empty, the Action will not be available to any users/departments/groups.

Required when creating a new Action.
actions.{actionname}.entities[].type String Conditional The type of the entity the Action is granted to.
  • USER: User
  • GROUP: Group
  • ORGANIZATION: Department
For Apps in a guest space, specifying a Department will result in an error.

Required when specifying the actions.{actionname}.entities parameter.
actions.{actionname}.entities[].code String Conditional The code of the entity the Action is granted to.
For guest users, add guest/ before the login name.

Required when specifying the actions.{actionname}.entities parameter.
revision Integer or String Specify the revision number of the settings that will be deployed.
The request will fail if the revision number is not the latest revision.
The revision will not be checked if this parameter is ignored or -1 is specified.

Sample Request

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var body = {
  'app': kintone.app.getId(),
  'actions': {
    'Action_A': {
      'name': 'Action_A',
      'index': '0',
      'destApp': {
        'code': 'INVOICE',
      },
      'mappings': [
        {
          'srcType': 'FIELD',
          'srcField': 'CompanyName',
          'destField': 'CompanyName',
        },
        {
          'srcType': 'FIELD',
          'srcField': 'DivisionName',
          'destField': 'DivisionName',
        },
        {
          'srcType': 'RECORD_URL',
          'destField': 'URL',
        }
      ],
      'entities': [
        {
          'type': 'USER',
          'code': 'userA',
        }
      ],
    },
  },
};

kintone.api(kintone.api.url('/k/v1/preview/app/actions.json', 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
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$ curl -X PUT \
  https://{subdomain}.kintone.com/v1/app/actions.json \
  -H 'X-Cybozu-Authorization: a2ludG9uZTpkZXZlbG9wZXI=' \
  -H 'Content-Type: application/json' \
  -d '{"actions": [
        {
          "app": "1",
          "actions": {
            "Action_A": {
              "name": "Action_A",
              "index": "0",
              "destApp": {
                "code": "INVOICE"
              },
              "mappings": [
                {
                  "srcType": "FIELD",
                  "srcField": "CompanyName",
                  "destField": "CompanyName"
                },
                {
                  "srcType": "FIELD",
                  "srcField": "DivisionName",
                  "destField": "DivisionName",
                },
                {
                  "srcType": "RECORD_URL",
                  "destField": "URL"
                }
              ],
              "entities": [
                {
                  "type": "USER",
                  "code": "userA"
                }
              ]
            }
          },
          "revision": "2"
        }
      ]
    }'

Response Parameters

Parameter Type Description
revision String The revision number of the App settings.
actions Object An object listing Action settings.
actions.{actionname}.id String The ID of the Action.

Sample Response

1
2
3
4
5
6
7
8
{
  "revision": "2",
  "actions": {
    "Action_A": {
      "id": "7319"
    }
  }
}

Limitations

If multiple Actions have (or will result in having) the same name within the same App, this API will return an error.