Data
The Data API allows you to generate data based on a project’s schema. You can create data based on a specific entity, check the status of a data generation job, and retrieve the generated data.
Authentication
Include the API key in the Authorization
header:
Authorization: Bearer YOUR_API_KEY
Endpoints
Generating Data
POST /data/:project_id
This endpoint generates data based on the schema defined in the project. You need to specify the entity name, the number of rows to generate, and optionally the data format and webhook URL.
Parameters:
entity_name
(required): The name of the entity or table in the schema.count
(required): The number of rows to generate.format
(optional): The format of the generated data. Accepted values are:json
(default)csv
parquet
webhook_url
(optional): A URL to send a webhook notification when the data generation is complete.
Example Request Body:
{
"entity_name": "UserProfile",
"count": 1000,
"format": "json",
"webhook_url": "https://example.com/webhook"
}
Response:
{
"id": "gen789",
"status": "pending"
}
The response includes:
- id: The unique ID of the data generation job.
- status: The status of the job (pending, processing, completed, or failed).
Checking Generation Status
This endpoint checks the status of a data generation job and provides the download URLs for the generated data once the job is complete.
GET /data/:data_processing_id/status
Parameters:
:data_processing_id
(required): The ID of the data generation job.
Example Request:
GET /data/gen789/status
Response:
{
"id": "gen789",
"status": "completed",
"data": {
"UserProfile": "https://example.com/data/user_profile.json",
"OrderDetails": "https://example.com/data/order_details.json"
}
}
The response includes:
id
: The unique ID of the data generation job.status
: The status of the job. Possible values include:pending
: The job is in the queue and has not started.processing
: The job is currently being processed.completed
: The job has been successfully completed.failed
: The job failed during processing.
data
: A dictionary where each key is anentity_name
, and the value is the URL to download the generated data for that entity. A job may have multiple entities, each with its own download URL.