smartInvoice
Last updated
curl -X POST "https://use.laigo.io/api/FileUpload/v1/Upload/smartInvoice" \
-H "Authorization: Bearer my-accessToken-here" \
-F "email=my-email-here" \
-F "outputFormats=JSON" \
-F "file=@my-file-location-here"var client = new HttpClient();
var email = "my-email-here";
var outputFormats = "JSON";
var url = $"https://use.laigo.io/api/FileUpload/v1/Upload/smartInvoice?email={Uri.EscapeDataString(email)}&outputFormats={Uri.EscapeDataString(outputFormats)}";
var request = new HttpRequestMessage(HttpMethod.Post, url);
request.Headers.Add("Authorization", "Bearer my-accessToken-here");
var content = new MultipartFormDataContent();
content.Add(new StreamContent(File.OpenRead("my-file-location-here")), "file", "my-file-location-here");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());import requests
url = "https://use.laigo.io/api/FileUpload/v1/Upload/smartInvoice"
headers = {
"Authorization": "Bearer my-accessToken-here"
}
files = {
"email": (None, "my-email-here"),
"outputFormats": (None, "JSON"),
"file": ("sample.pdf", open("my-file-location-here", "rb"))
}
response = requests.post(url, headers=headers, files=files)
print(response.text)<input type="file" id="fileInput">
<button onclick="uploadFile()">Upload</button>
<script>
function uploadFile() {
var fileInput = document.getElementById('fileInput');
var file = fileInput.files[0];
var formData = new FormData();
formData.append("email", "my-email-here");
formData.append("outputFormats", "JSON");
formData.append("file", file);
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
console.log(xhr.responseText);
} else {
console.error("Error:", xhr.statusText);
}
}
};
xhr.open("POST", "https://use.laigo.io/api/FileUpload/v1/Upload/smartInvoice");
xhr.setRequestHeader("Authorization", "Bearer my-accessToken-here");
xhr.send(formData);
}
</script><?php
$ch = curl_init();
$url = "https://use.laigo.io/api/FileUpload/v1/Upload/smartInvoice";
$headers = array(
"Authorization: Bearer my-accessToken-here"
);
$data = array(
"email" => "my-email-here",
"outputFormats" => "JSON",
"file" => new CurlFile("my-file-location-here", "application/pdf", "sample.pdf")
);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if ($response === false) {
echo 'Curl error: ' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>