Example Workflows
Here you can find example workflows that combine two or more REST API endpoints to perform common operations.
Upload a CSV file containing a single-table dataset and download a CSV file containing a synthetic dataset
- Upload a dataset as a CSV file
- (optional) Detect its schema
- Create a source catalog that reads from the file
- Create a generator that reads from the source catalog
- Use the generator to run an execution
- Download a ZIP file containing the synthetic dataset as a CSV file
Assumptions
We assume:
- our requests contain the required
Authorization
header (see the OpenAPI Documentation for more information) - We have a CSV file named
sample.csv
containing the following text:
Upload a dataset as a CSV file
First we need to upload the dataset to the platform. We do so with a
POST /api/v1/catalogs/uploads
request with a multipart/form-data
payload containing the file:
and receive a 200 OK
response with payload:
(optional) Detect its schema
To correctly read data from the dataset the platform needs to know its schema. The schema can be automatically detected by the platform, but this is not mandatory if we already know it or can determine it by ourselves. For this example, we will detect it.
NOTE: the detection is heuristic, so it must be reviewed to avoid inaccuracies
We make a POST /api/v1/catalogs/create/introspect
with payload:
and receive a 200 OK
response with payload:
We review it and confirm it matches our data correctly.
Create a source catalog that reads from the file
We make a POST /api/v1/catalogs
request with payload containing:
config
: the same input we used for the introspection (schema detection) stepschema
: the schema we received from the introspection (schema detection) step
(or that we determined on our own if we skipped it)
and receive a 200 OK
response with payload:
Create a generator that reads from the source catalog
In order to generate synthetic data we need a generator that uses our source catalog. We create it with a
POST /api/v1/generators
request with payload:
and receive a 200 OK
response with payload:
generators can be configured with many additional parameters. In this scenario their default values are enough and we omit them.
Use the generator to run an execution
We make a POST /api/v1/generators/xXFQV82VG84wphJrR3f9MHmhgw/executions
with no payload and receive a 200 OK
response with payload:
Since status
is "pending"
we wait some time then make a
request and receive a 200 OK
response with payload:
this time status
is "completed"
.
(otherwise we wait and repeat)
Download a ZIP file containing the synthetic dataset as a CSV file
We make a GET /api/v1/catalogs/cjg4XFmvW52CGvhp5v7XhRv3vg/download?fmt=csv
request and receive a 200 OK
response
with payload:
Here url
contains the URL of a ZIP
file that can be downloaded and extracted to find the sample.csv
file
containing the CSV synthetic dataset: