Create an attachment on a SAR
curl --request POST \
--url https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/ \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--form 'file=<string>'import requests
url = "https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
options.body = form;
fetch('https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/")
.header("X-API-Key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/",
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\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"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;
}require 'uri'
require 'net/http'
url = URI("https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/")
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.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AlwaysMultipartFormData = true;
request.AddHeader("X-API-Key", "<api-key>");
request.FormBoundary = "---011000010111000001101001";
request.AddParameter("file", "<string>");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
val request = Request.Builder()
.url("https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/")
.post(body)
.addHeader("X-API-Key", "<api-key>")
.build()
val response = client.newCall(request).execute()import Foundation
let parameters = [
[
"name": "file",
"value": "<string>"
]
]
let boundary = "---011000010111000001101001"
var body = ""
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["contentType"]!
let fileContent = try String(contentsOfFile: filename, encoding: .utf8)
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let postData = Data(body.utf8)
let url = URL(string: "https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["X-API-Key": "<api-key>"]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self)){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"fileName": "<string>",
"contentType": "<string>",
"sizeBytes": 123,
"checksumSha256": "<string>",
"uploadedBy": 123,
"uploadedAt": "2023-11-07T05:31:56Z"
}Create an attachment on a SAR
Attaches an evidence file to the report. Sent as multipart/form-data with the file in file, not as JSON. There is a cap on how many files one report may carry and on the size of each.
POST
/
api
/
v1
/
sars
/
{sar_id}
/
attachments
/
Create an attachment on a SAR
curl --request POST \
--url https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/ \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--form 'file=<string>'import requests
url = "https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
options.body = form;
fetch('https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/")
.header("X-API-Key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/",
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\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"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;
}require 'uri'
require 'net/http'
url = URI("https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/")
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.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AlwaysMultipartFormData = true;
request.AddHeader("X-API-Key", "<api-key>");
request.FormBoundary = "---011000010111000001101001";
request.AddParameter("file", "<string>");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
val request = Request.Builder()
.url("https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/")
.post(body)
.addHeader("X-API-Key", "<api-key>")
.build()
val response = client.newCall(request).execute()import Foundation
let parameters = [
[
"name": "file",
"value": "<string>"
]
]
let boundary = "---011000010111000001101001"
var body = ""
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["contentType"]!
let fileContent = try String(contentsOfFile: filename, encoding: .utf8)
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let postData = Data(body.utf8)
let url = URL(string: "https://ivs-tx-monitoring.idenfy.com/api/v1/sars/{sar_id}/attachments/")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["X-API-Key": "<api-key>"]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self)){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"fileName": "<string>",
"contentType": "<string>",
"sizeBytes": 123,
"checksumSha256": "<string>",
"uploadedBy": 123,
"uploadedAt": "2023-11-07T05:31:56Z"
}Body
multipart/form-dataapplication/x-www-form-urlencoded
Response
201 - application/json
Was this page helpful?