Replace all data in a dataset

Replace will delete all the existing data within the dataset and then write the new data.

In effect, your dataset will contain only the new records that you just pushed (you can think of it as similar to an overwrite action).

It calls the PUT method.

PUT https://api.geckoboard.com/datasets/:id/data

Example

curl https://api.geckoboard.com/datasets/sales.by_day/data \
  -X PUT \
  -u '222efc82e7933138077b1c2554439e15:' \
  -H 'Content-Type: application/json' \
  -d '{
  "data": [
    {
      "timestamp": "2018-01-01T12:00:00Z",
      "amount": 819
    },
    {
      "timestamp": "2018-01-02T12:00:00Z",
      "amount": 409
    },
    {
      "timestamp": "2018-01-03T12:00:00Z",
      "amount": 164
    }
  ]
}'

Response:

{}
data
An array of objects with key + values representing a record in your dataset.
dataset.put(items, callback);

Example

[
  { timestamp: "2018-01-01T12:00:00Z", amount: 8192 },
  { timestamp: "2018-01-02T12:00:00Z", amount: 4096 },
  { timestamp: "2018-01-03T12:00:00Z", amount: 16384 }
],
{}
Attribute Type Required?
  items Array Yes
callback Function No
    error Error | Null No
dataset.put(items)

Example

dataset.put([
  {
    timestamp: DateTime.new(2018, 1, 2, 12, 0, 0),
    amount: 40900
  },
  {
    timestamp: DateTime.new(2018, 1, 3, 12, 0, 0),
    amount: 16400
  }
])
dataset.put(items)

Example

dataset.put([
  { 'timestamp': '2018-01-01T12:00:00Z', 'amount': 819 },
  { 'timestamp': '2018-01-02T12:00:00Z', 'amount': 409 },
  { 'timestamp': '2018-01-03T12:00:00Z', 'amount': 164 }
])
Attribute Type Required?
  items list Yes
Was this article helpful?

Awesome! 👍  Thanks so much for your feedback!