Post Record to a Kintone App Using Postman (X-Cybozu-API-Token)

Dear Developers,

Currently, I have trouble creating a record to a kintone app using POST record in a postman, while I have no problem when Get Records, but when creating a record, its response was like this:

{
"code": "CB_IL02",
"id": "HhAhXmFFOy9XlTLgKWQt",
"message": "不正なリクエストです。"
}

The message translated as “Invalid request.”

My header is like this:

X-Cybozu-API-Token: 3a2zV...
Content-Type: application/json

The URL I used is like this, based on the Post Record documentation on the Kintone developer

https://sub-domain.kintone.com/k/v1/record.json?app=1007

Where app=1007 is the Params required.

This Post Record is actually succeeded when I used X-Cybozu-Authorization, but I didn’t want to use username:password, I wanted to use the token I configured on the app instead of the other one.

Please help; any answer would be so appreciated.

Thank you very much.

Dear Developers,

I just found how to make it work using Postman. You need to put the app (APP_ID) inside the Body, not in the Params, and then, instead of using form-data, you need to use raw. So the required steps are:

  • Headers: X-Cybozu-API-Token (value is the token generated from the app you want to create a record in) and Content-Type: application/json

  • Body (raw), filled with something like this:

      {
          "app": 1007,
          "record": {
              "Field_Name": {
                  "value": "Your_Field_Value"
              },
              // Other field names and values here, delete this comment line
          }
      }
    

The response should now give you different messages, like if you need to fill a required field that cannot be null, something like this:

  {
      "code": "CB_VA01",
      "id": "eYIulRwEM1ioO1moloPE",
      "message": "入力内容が正しくありません。",
      "errors": {
          "record.JobRequest.value": {
              "messages": [
                  "必須です。"
              ]
          },
          "record.CandidateName.value": {
              "messages": [
                  "必須です。"
              ]
          }
      }
  }

The success response would look like this:

  {
      "id": "2",
      "revision": "1"
  }

I think that is all, thank you.

In case of API Tokens, the language of the messages that are returned depend on the language settings of the domain.

This can be set by accessing the Localization settings in the Users & System Administration page _ https://{subdomain}.kintone.com/admin/localization _