Upload import session chunk
curl --request POST \
--url https://app.sure.am/api/v1/import_sessions/{id}/chunks \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"sequence": 2,
"raw_file_content": "<string>",
"client_chunk_id": "<string>"
}
'import requests
url = "https://app.sure.am/api/v1/import_sessions/{id}/chunks"
payload = {
"sequence": 2,
"raw_file_content": "<string>",
"client_chunk_id": "<string>"
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({sequence: 2, raw_file_content: '<string>', client_chunk_id: '<string>'})
};
fetch('https://app.sure.am/api/v1/import_sessions/{id}/chunks', 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.sure.am/api/v1/import_sessions/{id}/chunks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sequence' => 2,
'raw_file_content' => '<string>',
'client_chunk_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$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.sure.am/api/v1/import_sessions/{id}/chunks"
payload := strings.NewReader("{\n \"sequence\": 2,\n \"raw_file_content\": \"<string>\",\n \"client_chunk_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
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.sure.am/api/v1/import_sessions/{id}/chunks")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sequence\": 2,\n \"raw_file_content\": \"<string>\",\n \"client_chunk_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.sure.am/api/v1/import_sessions/{id}/chunks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sequence\": 2,\n \"raw_file_content\": \"<string>\",\n \"client_chunk_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "SureImport",
"status": "pending",
"chunks_count": 1,
"summary": {},
"chunks": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence": 2,
"status": "pending",
"rows_count": 1,
"summary": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"client_chunk_id": "<string>",
"error": {}
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"client_session_id": "<string>",
"expected_chunks": 2,
"error": {}
}
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}Import Sessions
Upload import session chunk
Attach an ordered Sure NDJSON chunk to an import session. Chunks are idempotent by sequence and client_chunk_id with content verification.
POST
/
api
/
v1
/
import_sessions
/
{id}
/
chunks
Upload import session chunk
curl --request POST \
--url https://app.sure.am/api/v1/import_sessions/{id}/chunks \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"sequence": 2,
"raw_file_content": "<string>",
"client_chunk_id": "<string>"
}
'import requests
url = "https://app.sure.am/api/v1/import_sessions/{id}/chunks"
payload = {
"sequence": 2,
"raw_file_content": "<string>",
"client_chunk_id": "<string>"
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({sequence: 2, raw_file_content: '<string>', client_chunk_id: '<string>'})
};
fetch('https://app.sure.am/api/v1/import_sessions/{id}/chunks', 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.sure.am/api/v1/import_sessions/{id}/chunks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sequence' => 2,
'raw_file_content' => '<string>',
'client_chunk_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$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.sure.am/api/v1/import_sessions/{id}/chunks"
payload := strings.NewReader("{\n \"sequence\": 2,\n \"raw_file_content\": \"<string>\",\n \"client_chunk_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
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.sure.am/api/v1/import_sessions/{id}/chunks")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sequence\": 2,\n \"raw_file_content\": \"<string>\",\n \"client_chunk_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.sure.am/api/v1/import_sessions/{id}/chunks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sequence\": 2,\n \"raw_file_content\": \"<string>\",\n \"client_chunk_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "SureImport",
"status": "pending",
"chunks_count": 1,
"summary": {},
"chunks": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence": 2,
"status": "pending",
"rows_count": 1,
"summary": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"client_chunk_id": "<string>",
"error": {}
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"client_session_id": "<string>",
"expected_chunks": 2,
"error": {}
}
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>",
"details": [
"<string>"
],
"errors": [
"<string>"
]
}Authorizations
API key for authentication. Generate one from your account settings.
Path Parameters
Import session ID
Body
application/jsonmultipart/form-data
Response
chunk uploaded
Show child attributes
Show child attributes
Was this page helpful?
⌘I