Update a dataset item
client.DatasetItems.Update(ctx, datasetItemID, body) (*DatasetItem, error)
PATCH/v5/dataset-items/{dataset_item_id}
Update the data payload and optional file associations of a dataset item.
The request replaces the item’s data in full and, if provided, its file associations; there is no partial-field merge. Data keys may not collide with reserved dataset- or evaluation-item field names, and any referenced files must exist and be a supported media format. Items that are archived or soft-deleted cannot be updated. The update is applied as a new dataset version rather than overwriting the previous record, so prior versions remain retrievable.
Update a dataset item
package main
import (
"context"
"fmt"
"github.com/scaleapi/sgp-dev-go"
"github.com/scaleapi/sgp-dev-go/option"
)
func main() {
client := sgpdev.NewClient(
option.WithAPIKey("My API Key"),
option.WithAccountID("My Account ID"),
)
datasetItem, err := client.DatasetItems.Update(
context.TODO(),
"dataset_item_id",
sgpdev.DatasetItemUpdateParams{
Data: map[string]any{
"foo": "bar",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", datasetItem.ID)
}
{
"id": "id",
"content_hash": "content_hash",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": {
"id": "id",
"type": "user",
"object": "identity"
},
"data": {
"foo": "bar"
},
"updated_at": "2019-12-27T18:11:19.117Z",
"archived_at": "2019-12-27T18:11:19.117Z",
"dataset_id": "dataset_id",
"files": {
"foo": "string"
},
"object": "dataset.item"
}Returns Examples
{
"id": "id",
"content_hash": "content_hash",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": {
"id": "id",
"type": "user",
"object": "identity"
},
"data": {
"foo": "bar"
},
"updated_at": "2019-12-27T18:11:19.117Z",
"archived_at": "2019-12-27T18:11:19.117Z",
"dataset_id": "dataset_id",
"files": {
"foo": "string"
},
"object": "dataset.item"
}