Once you sign up and obtain an API key, you get access to our REST API which lets you upload and convert files without the need to use our web interface.
Authentication
For your API calls to go through, you need to authenticate using your key.
To find your key, head over to your account page.
Sqlify uses the standard Authorization
header to do this. You can pass in your key like his:
Authorization: Bearer {API_KEY}
We also support basic HTTP authentication, so you can use it easily with curl (don’t forget the colon, so curl doesn’t prompt for a password):
curl https://api.konbert.com/v1/files/{FILE_ID} -u "{API_KEY}:"
Upload your file
Now we need to upload the data that we want to convert, we can do this in different ways.
Provide a URL
If your data lives in a publicly accessible HTTP server, you can provide the URL and Sqlify will download and store the file.
curl https://api.konbert.com/v1/files \
-u "{API_KEY}:" \
-d "url=https://konbert.com/example.csv"
Simple file upload
If your file is less than 100 MB, you should do a simple file upload like this:
curl https://api.konbert.com/v1/file \
-u "{API_KEY}:" \
-F "file=@example.csv"
Multi part file upload
Go over to this guide to see how to do multi part uploads.
Converting your file
Once you’ve uploaded your file and got a file id, you can queue it to be processed. At the moment, there exist these three steps that you can run on a file:
-
sqlify/export-csv
-
sqlify/export-json
-
sqlify/export-sql
You can run a step like this:
curl https://api.konbert.com/v1/steps/sqlify/export-sql/run \
-u "{API_KEY}:" \
-d "file_id={FILE_ID}"
and you should a response with a new file containing the result data:
{
"status":"ok",
"message":"",
"data":{
"url":"https://konbert.com/export/{FILE_ID}",
"result_file":"3f4d23ec-8edc-4e7c-95ff-bfc69dee2c6b",
"output_file":"https://api.konbert.com/v1/files/{FILE_ID}"
}
}
if your file contains errors or there is a problem processing it, you’ll get something like this:
{
"status":"error",
"message":"Error message",
"data":{}
}
Now all you need to do is download your file:
curl https://api.konbert.com/v1/files/{FILE_ID}/data -u "{API_KEY}:" > file.sql