Create
Create a Dataset
url = 'https://app.graphite-note.com/api/dataset-create'Example Usage
Example Python Implementation
Last updated
Was this helpful?
url = 'https://app.graphite-note.com/api/dataset-create'Last updated
Was this helpful?
Was this helpful?
POST /dataset-create
Authorization: Bearer YOUR-TENANT-TOKEN
{
"user-code": "0f02b4d4f9ae",
"columns": [
{
"name": "InvoiceNo",
"alias": "InvoiceNo",
"type": "dimension",
"subtype": "text"
},
{
"name": "StockCode",
"alias": "StockCode",
"type": "dimension",
"subtype": "text"
},
{
"name": "Description",
"alias": "Description",
"type": "dimension",
"subtype": "text"
},
{
"name": "Quantity",
"alias": "Quantity",
"type": "measure",
"subtype": "numeric",
"format": "#,###.##"
},
{
"name": "InvoiceDate",
"alias": "InvoiceDate",
"type": "dimension",
"subtype": "datetime",
"format": "Y-d-m H:i:s"
},
{
"name": "UnitPrice",
"alias": "UnitPrice",
"type": "measure",
"subtype": "numeric",
"format": "#,###.##"
},
{
"name": "CustomerID",
"alias": "CustomerID",
"type": "measure",
"subtype": "numeric",
"format": "#,###.##"
}
],
"name": "Client onboarding dataset creation"
}
{
"data": {
"dataset-code": "eca2ad3940e3",
"table-name": "dataset_csv_eca2ad3940e3",
"columns": 7
}
}
import requests
# Replace with your actual tenant token
tenant_token = YOUR-TOKEN
# Replace with your actual endpoint URL
url = 'https://app.graphite-note.com/api/dataset-create'
# Payload for dataset creation
payload = {
"user-code": YOUR-CODE,
"columns": [
{
"name": "order",
"alias": "order",
"type": "dimension",
"subtype": "text"
},
{
"name": "customer_id",
"alias": "customer_id",
"type": "dimension",
"subtype": "text"
},
{
"name": "number_of_items",
"alias": "number_of_items",
"type": "measure",
"subtype": "numeric",
"format": "#,###.##"
}
],
"name": "API dataset test"
}
# Headers with the bearer token
headers = {
"Authorization": f"Bearer {tenant_token}",
"Content-Type": "application/json"
}
# Send the POST request
response = requests.post(url, json=payload, headers=headers)
# Print response
print("Status code:", response.status_code)
print("Response body:", response.json())