Avatar

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

Afief

Dear Developers,

Currently I have a trouble on 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, it 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: 3a2zVRni9DAVv4rC4ObaIyF0Bmw7JxvKLWFxk3d8
Content-Type: application/json

The url I used is like this, based on the Post Record documentation on 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 succeed when I used X-Cybozu-Authorization, but I don't want to use username:password, I want 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.

Follow 2 followers
1

2 comments

Avatar
Afief 0 votes

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 things that required are:

  • Headers: X-Cybozu-API-Token (value is the token generated from the app you want to create a record there) and Content-Type: application/json
  • Body (raw), fill with something like this:
{
app: 1007,
record: {
Field_Name: {
value: 'Your_Field_Value'
},
// Other field name and value here, delete this comment line
}
}

The response now should tell you different messages, like you need to fill the 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 be like this

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

I think that is all, thank you

0
Comment actions Permalink
Avatar
William Sayama 1 vote

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

 

1
Comment actions Permalink