LoginSignup
0
0

More than 3 years have passed since last update.

go-kintoneでのレコードの更新(PUT)のやり方

Posted at

公式Doc

やり方


import (
    "github.com/kintone/go-kintone"
)

...

//アプリの初期化
app := &kintone.App{
    "example.cybozu.com",
    "user1",
    "password",
    25, // AppID
}

// 更新用のデータ ※更新したいフィールドのみで大丈夫。
dataMap := map[string]interface{}{"フィールド名": kintone.SingleLineTextField("更新したいテキスト") /*, ...その他も*/ }

// 更新したいレコードのID
id := 1

//レコードの初期化
editedRecord := kintone.NewRecordWithId(id, dataMap)

//更新の実行
err := app.UpdateRecord(editedRecord, true)

ハマったところ

GetRecordしたレコードのフィールドをいじって、それをUpdateRecordしてしまっていた。

RECORD_ID型のフィールドに値を設定することはできません。

それはそう

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0