Skip to content

Get a dataset item

client.DatasetItems.Get(ctx, datasetItemID, query) (*DatasetItem, error)
GET/v5/dataset-items/{dataset_item_id}

Retrieve a single dataset item by its identifier.

The lookup is scoped to the caller’s account. By default the current (latest) version of the item is returned; passing version returns the item as it existed at that dataset version, which allows reading an item that was later updated or soft-deleted.

ParametersExpand Collapse
datasetItemID string
query DatasetItemGetParams
Version param.Field[int64]Optional

Optional dataset version. When unset, returns the latest version.

ReturnsExpand Collapse
type DatasetItem struct{…}
ID string

The unique identifier of the entity.

ContentHash string
CreatedAt Time

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

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Data map[string, any]
UpdatedAt Time

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

formatdate-time
ArchivedAt TimeOptional

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

formatdate-time
DatasetID stringOptional
Files map[string, string]Optional
Object DatasetItemObjectOptional

Get 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.Get(
    context.TODO(),
    "dataset_item_id",
    sgpdev.DatasetItemGetParams{

    },
  )
  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"
}