Skip to content

Get a dataset

client.Datasets.Get(ctx, datasetID, query) (*Dataset, error)
GET/v5/datasets/{dataset_id}

Retrieve a single dataset by its id.

By default an archived dataset is not returned; set include_archived to true to fetch a dataset regardless of whether it has been archived.

ParametersExpand Collapse
datasetID string
query DatasetGetParams
IncludeArchived param.Field[bool]Optional
ReturnsExpand Collapse
type Dataset struct{…}
ID string

The unique identifier of the entity.

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
CurrentVersionNum int64
Name string
Tags []string

The tags associated with the entity

ArchivedAt TimeOptional

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

formatdate-time
Description stringOptional
Object DatasetObjectOptional

Get a dataset

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"),
  )
  dataset, err := client.Datasets.Get(
    context.TODO(),
    "dataset_id",
    sgpdev.DatasetGetParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", dataset.ID)
}
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": {
    "id": "id",
    "type": "user",
    "object": "identity"
  },
  "current_version_num": 0,
  "name": "name",
  "tags": [
    "string"
  ],
  "archived_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "object": "dataset"
}
Returns Examples
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": {
    "id": "id",
    "type": "user",
    "object": "identity"
  },
  "current_version_num": 0,
  "name": "name",
  "tags": [
    "string"
  ],
  "archived_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "object": "dataset"
}