Skip to content
GuidesBlogPlaygroundDashboard

Create a new dataset (admin only)

client.Datasets.New(ctx, body) (*Dataset, error)
POST/api/v1/datasets

Create a new dataset (admin only)

ParametersExpand Collapse
body DatasetNewParams
Name param.Field[string]

Human-readable dataset name

Slug param.Field[string]

URL-friendly identifier (lowercase, hyphens, no spaces)

Attribution param.Field[string]optional

Required attribution text

Description param.Field[string]optional

Dataset description

License param.Field[string]optional

License identifier (e.g. CC-BY-4.0)

SourceURL param.Field[string]optional

Source data URL

formaturi
ReturnsExpand Collapse
type Dataset struct{…}

Metadata for a custom dataset. Datasets contain user-uploaded geospatial features separate from the OSM data.

ID string

Dataset UUID

formatuuid
InsertedAt Time

Creation timestamp (UTC)

formatdate-time
Name string

Human-readable dataset name

Slug string

URL-friendly identifier

UpdatedAt Time

Last update timestamp (UTC)

formatdate-time
Attribution stringoptional

Required attribution text

Description stringoptional

Dataset description

License stringoptional

License identifier (e.g. CC-BY-4.0)

SourceURL stringoptional

URL of the original data source

formaturi

Create a new dataset (admin only)

package main

import (
  "context"
  "fmt"

  "github.com/plazafyi/plaza-go"
  "github.com/plazafyi/plaza-go/option"
)

func main() {
  client := githubcomplazafyiplazago.NewClient(
    option.WithAPIKey("My API Key"),
  )
  dataset, err := client.Datasets.New(context.TODO(), githubcomplazafyiplazago.DatasetNewParams{
    Name: githubcomplazafyiplazago.F("NYC Bike Lanes"),
    Slug: githubcomplazafyiplazago.F("nyc-bike-lanes"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", dataset.ID)
}
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "inserted_at": "2019-12-27T18:11:19.117Z",
  "name": "NYC Bike Lanes",
  "slug": "nyc-bike-lanes",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "attribution": "attribution",
  "description": "description",
  "license": "license",
  "source_url": "https://example.com"
}
Returns Examples
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "inserted_at": "2019-12-27T18:11:19.117Z",
  "name": "NYC Bike Lanes",
  "slug": "nyc-bike-lanes",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "attribution": "attribution",
  "description": "description",
  "license": "license",
  "source_url": "https://example.com"
}