Skip to content

List dataset items

client.DatasetItems.List(ctx, query) (*CursorPage[DatasetItem], error)
GET/v5/dataset-items

List dataset items belonging to the caller’s account, paginated.

dataset_id is optional: when omitted, items across all of the account’s datasets are returned; when provided, results are restricted to that dataset. A specific version may be requested only together with a dataset_id — passing version without dataset_id is rejected. By default only current items at the latest version are listed (soft-deleted items are excluded); archived items are excluded unless include_archived is true.

ParametersExpand Collapse
query DatasetItemListParams
DatasetID param.Field[string]Optional

Optional dataset identifier. Must be provided if a specific version is requested.

EndingBefore param.Field[string]Optional
IncludeArchived param.Field[bool]Optional
Limit param.Field[int64]Optional
maximum10000
minimum1
SortBy param.Field[string]Optional
SortOrder param.Field[SortOrder]Optional
StartingAfter param.Field[string]Optional
Version param.Field[int64]Optional

Optional dataset version. When unset, returns the latest version. Requires a valid dataset_id when set.

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

List dataset items

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"),
  )
  page, err := client.DatasetItems.List(context.TODO(), sgpdev.DatasetItemListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "has_more": true,
  "items": [
    {
      "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"
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}
Returns Examples
{
  "has_more": true,
  "items": [
    {
      "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"
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}