Upload

The upload endpoint allows you to overwrite or create a new upload in a collection. If the collection or upload does not exist, it will automatically be created.

Overwriting data is generally safe due to processing. The platform has built-in hooks to notify integrations of changes to a collection. Integrations will then rescan current data, and update accordingly. This allows API integrations to safely wipe data and provide bulk uploads instead of managing each row.

However, if you want to only append data to existing uploads - see inserts.

Parameters

Key

Type

REQUIRED

collection

String (Collection Name)

upload

String (Upload Name)

data

Array of data rows

Data Row

Key

Type

Row 0

Array of strings representing the headers

Row N

Array of Any representing each row

Example

The example below uploads data with 5 columns and n rows. You will notice the first row contains the headers.

If the collection or upload does not exist, it will automatically be created.

curl -X POST \
  v1/data/upload\
  -H 'Authorization: Basic <Your Base64 Encoded Token>'\
  -d '{
    "collection" : "Collection 1",
    "upload"     : "Upload 1",
    "data"       : [
        ["User Code","Date","Tasks","KPI"],
        ["001","2020-12-01",1,50],
        ["002","2020-12-01",1,50],
        ...etc
    ]
}'

Success Response

The response returns current information on the collection. The stats property will detail how many uploads are in the collection, and what size the sum of the data is.

{
    "status": "success",
    "data": {
        "collection": "My Collection",
        "upload": "Upload 1",
        "stats": {
            "uploads": 1,
            "size": 258,
            "rows": 4
        }
    },
    "hash": "925e88d80a1fa85e4a13749f20aa79c9",
    "response_time": 0.7646100521087646
}

Last updated