Import a spreadsheet
curl --request POST \
--url https://app.flextell.ai/api/v1/import/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'X-Tenant: <x-tenant>' \
--form file=@example-file \
--form 'mapping=<string>'import requests
url = "https://app.flextell.ai/api/v1/import/files"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "mapping": "<string>" }
headers = {
"X-Tenant": "<x-tenant>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('mapping', '<string>');
const options = {
method: 'POST',
headers: {'X-Tenant': '<x-tenant>', Authorization: 'Bearer <token>'}
};
options.body = form;
fetch('https://app.flextell.ai/api/v1/import/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.flextell.ai/api/v1/import/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mapping\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"X-Tenant: <x-tenant>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.flextell.ai/api/v1/import/files"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mapping\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tenant", "<x-tenant>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.flextell.ai/api/v1/import/files")
.header("X-Tenant", "<x-tenant>")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mapping\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.flextell.ai/api/v1/import/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tenant"] = '<x-tenant>'
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mapping\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": "<string>",
"data": {
"id": 123,
"import_source_id": 123,
"user_id": 123,
"status": "<string>",
"status_label": "Bekliyor",
"phase": "<string>",
"phase_label": "Kaynaktan okunuyor",
"is_legacy": true,
"selected_types": [
"<unknown>"
],
"options": [
"<unknown>"
],
"total_records": 123,
"fetched_records": 123,
"processed_records": 123,
"created_records": 123,
"updated_records": 123,
"unchanged_records": 123,
"skipped_records": 123,
"failed_records": 123,
"duplicate_records": 123,
"successful_records": 123,
"progress_percentage": "<string>",
"is_stalled": true,
"can_be_cancelled": true,
"error_message": "<string>",
"throughput": "<string>",
"eta_seconds": "<string>",
"elapsed_seconds": "<string>",
"resume_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"last_activity_at": "2023-11-07T05:31:56Z",
"verification": {
"ok": true,
"mismatch_count": 123,
"checks": [
"<unknown>"
]
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"import_source": {
"id": 123,
"name": "<string>",
"company_logo": null
},
"user": {
"id": 123,
"name": "<string>",
"avatar_url": "<string>"
},
"children": [
{
"id": 123,
"type": "<string>",
"type_label": "Hasta",
"status": "<string>",
"status_label": "Bekliyor",
"phase": "<string>",
"phase_label": "Kaynaktan okunuyor",
"total_records": 123,
"fetched_records": 123,
"processed_records": 123,
"created_records": 123,
"updated_records": 123,
"unchanged_records": 123,
"skipped_records": 123,
"failed_records": 123,
"duplicate_records": 123,
"successful_records": 123,
"progress_percentage": "<string>",
"verification": {
"checks": [
"<unknown>"
]
},
"completed_at": "2023-11-07T05:31:56Z"
}
]
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"success": false,
"error_code": "SETUP_REQUIRED",
"message": "Complete the required setup steps to continue.",
"data": {
"next_step": "clinic_info"
}
}ImportFile
Import a spreadsheet
Stages every row and starts an import run, followed like any other run through the import history. A row that matches an existing record by its natural key (a product’s barcode) updates it; blank cells keep the stored value. A clinic runs one spreadsheet import at a time; a second one gets 409.
POST
/
v1
/
import
/
files
Import a spreadsheet
curl --request POST \
--url https://app.flextell.ai/api/v1/import/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'X-Tenant: <x-tenant>' \
--form file=@example-file \
--form 'mapping=<string>'import requests
url = "https://app.flextell.ai/api/v1/import/files"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "mapping": "<string>" }
headers = {
"X-Tenant": "<x-tenant>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('mapping', '<string>');
const options = {
method: 'POST',
headers: {'X-Tenant': '<x-tenant>', Authorization: 'Bearer <token>'}
};
options.body = form;
fetch('https://app.flextell.ai/api/v1/import/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.flextell.ai/api/v1/import/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mapping\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"X-Tenant: <x-tenant>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.flextell.ai/api/v1/import/files"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mapping\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tenant", "<x-tenant>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.flextell.ai/api/v1/import/files")
.header("X-Tenant", "<x-tenant>")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mapping\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.flextell.ai/api/v1/import/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tenant"] = '<x-tenant>'
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mapping\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": "<string>",
"data": {
"id": 123,
"import_source_id": 123,
"user_id": 123,
"status": "<string>",
"status_label": "Bekliyor",
"phase": "<string>",
"phase_label": "Kaynaktan okunuyor",
"is_legacy": true,
"selected_types": [
"<unknown>"
],
"options": [
"<unknown>"
],
"total_records": 123,
"fetched_records": 123,
"processed_records": 123,
"created_records": 123,
"updated_records": 123,
"unchanged_records": 123,
"skipped_records": 123,
"failed_records": 123,
"duplicate_records": 123,
"successful_records": 123,
"progress_percentage": "<string>",
"is_stalled": true,
"can_be_cancelled": true,
"error_message": "<string>",
"throughput": "<string>",
"eta_seconds": "<string>",
"elapsed_seconds": "<string>",
"resume_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"last_activity_at": "2023-11-07T05:31:56Z",
"verification": {
"ok": true,
"mismatch_count": 123,
"checks": [
"<unknown>"
]
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"import_source": {
"id": 123,
"name": "<string>",
"company_logo": null
},
"user": {
"id": 123,
"name": "<string>",
"avatar_url": "<string>"
},
"children": [
{
"id": 123,
"type": "<string>",
"type_label": "Hasta",
"status": "<string>",
"status_label": "Bekliyor",
"phase": "<string>",
"phase_label": "Kaynaktan okunuyor",
"total_records": 123,
"fetched_records": 123,
"processed_records": 123,
"created_records": 123,
"updated_records": 123,
"unchanged_records": 123,
"skipped_records": 123,
"failed_records": 123,
"duplicate_records": 123,
"successful_records": 123,
"progress_percentage": "<string>",
"verification": {
"checks": [
"<unknown>"
]
},
"completed_at": "2023-11-07T05:31:56Z"
}
]
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"success": false,
"error_code": "SETUP_REQUIRED",
"message": "Complete the required setup steps to continue.",
"data": {
"next_step": "clinic_info"
}
}Yetkilendirmeler
oauth2bearer
Başlıklar
Gövde
multipart/form-data