HomeGuidesAPI ReferenceRelease notes
Log In
Guides

Ingest data via REST API

Superwise now supports data ingestion into our datasets via REST API, in addition to GCP/AWS buckets.

Here’s what you need to do:

  1. Create a Dataset: The first step is to create a dataset for data ingestion. Learn more about creating datasets here.
  2. Ingest a Data Record: Use the following code to log a data record to your dataset:

SDK:

sw.dataset.log_record_to_dataset(
    dataset_id="YOUR DATASET ID",
    data={
        "some_data_key": "some_data_value",
        "another_data_key": "another_data_value"
    })

API:

import requests
import json

url = "https://api.superwise.ai/v1/datasets/INSERT_DATASET_ID_HERE/log"

payload = json.dumps({
  "record": {
    "numeric_field": 1,
    "word_field": "value1"
  }
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer INSERT_TOKEN_HERE'
}

response = requests.request("POST", url, headers=headers, data=payload)

📘

Note

You can send only one data record at a time.