Append data to a dataset

Append will add new records to OR modify the already existing records within your dataset. It calls the POST method.

If you haven’t included a unique_by array with your dataset definition, then all new records will be appended to the existing contents of your dataset.

If you have included a unique_by array of fields, then any conflict between your new and existing records will be resolved by merging your updates into the contents of your dataset. This can be used to modify existing records in case their values have changed since your last update or if you want to fix an incorrect record.

Should the number of records in your dataset exceed the 5000 records limit following an Append, old records will be discarded.

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

Example

curl https://api.geckoboard.com/datasets/sales.by_day/data \
  -X POST \
  -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.
delete_by
An optional string specifying the name of a date or datetime field used order records for truncation.
dataset.post(items, options, 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 }
];
{
  delete_by: "timestamp";
}
Attribute Type Required?
  items Array Yes
options Object | Null No
    delete_by String No
callback Function No
    error Error | Null No
dataset.post(items, delete_by: optional_name_of_a_date_or_datetime_field)

Example

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

Example

dataset.post([
  { 'timestamp': '2018-01-03T12:00:00Z', 'amount': 312 },
  { 'timestamp': '2018-01-04T12:00:00Z', 'amount': 665 },
  { 'timestamp': '2018-01-05T12:00:00Z', 'amount': 453 }
], 'timestamp')
Attribute Type Required?
  items list Yes
  delete_by str No
Was this article helpful?

Awesome! 👍  Thanks so much for your feedback!