Skip to content

Update a dataset item

client.datasetItems.update(stringdatasetItemID, DatasetItemUpdateParams { data, files } body, RequestOptionsoptions?): DatasetItem { id, content_hash, created_at, 7 more }
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.

ParametersExpand Collapse
datasetItemID: string
body: DatasetItemUpdateParams { data, files }
data: Record<string, unknown>

Updated dataset item data

files?: Record<string, string>

Files to be associated to the dataset

ReturnsExpand Collapse
DatasetItem { id, content_hash, created_at, 7 more }
id: string

The unique identifier of the entity.

content_hash: string
created_at: string

The date and time when the entity was created in ISO format.

formatdate-time
created_by: Identity { id, type, object }

The identity that created the entity.

id: string
type: "user" | "service_account"
One of the following:
"user"
"service_account"
object?: "identity"
data: Record<string, unknown>
updated_at: string

The date and time when the entity was last updated in ISO format.

formatdate-time
archived_at?: string

The date and time when the entity was archived in ISO format.

formatdate-time
dataset_id?: string
files?: Record<string, string>
object?: "dataset.item"

Update a dataset item

import SGPClient from 'scale-gp';

const client = new SGPClient({
  accountID: 'My Account ID',
  apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});

const datasetItem = await client.datasetItems.update('dataset_item_id', { data: { foo: 'bar' } });

console.log(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"
}