Confirm an upload
curl --request POST \
--url https://ds.cominty.com/chat/files \
--header 'Content-Type: application/json' \
--header 'x-cominty-token: <api-key>' \
--data '
{
"etag": "<string>",
"key": "<string>"
}
'import requests
url = "https://ds.cominty.com/chat/files"
payload = {
"etag": "<string>",
"key": "<string>"
}
headers = {
"x-cominty-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-cominty-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({etag: '<string>', key: '<string>'})
};
fetch('https://ds.cominty.com/chat/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://ds.cominty.com/chat/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 => json_encode([
'etag' => '<string>',
'key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-cominty-token: <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://ds.cominty.com/chat/files"
payload := strings.NewReader("{\n \"etag\": \"<string>\",\n \"key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-cominty-token", "<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://ds.cominty.com/chat/files")
.header("x-cominty-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"etag\": \"<string>\",\n \"key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ds.cominty.com/chat/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-cominty-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"etag\": \"<string>\",\n \"key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"size": 123,
"mimetype": "<string>",
"origin": "user",
"share_links": [
{
"created_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"last_accessed_at": "2023-11-07T05:31:56Z",
"access_count": 123,
"revoked": true,
"expires_at": "2023-11-07T05:31:56Z",
"expired": true,
"protected": true,
"url": "<string>"
}
],
"url": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}API Reference
Confirm an upload
Last step of a file upload. Send the ETag from the storage response and the key from the upload permission. The response is a conversation file. Use its id as file_ids on a chat message.
POST
/
chat
/
files
Confirm an upload
curl --request POST \
--url https://ds.cominty.com/chat/files \
--header 'Content-Type: application/json' \
--header 'x-cominty-token: <api-key>' \
--data '
{
"etag": "<string>",
"key": "<string>"
}
'import requests
url = "https://ds.cominty.com/chat/files"
payload = {
"etag": "<string>",
"key": "<string>"
}
headers = {
"x-cominty-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-cominty-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({etag: '<string>', key: '<string>'})
};
fetch('https://ds.cominty.com/chat/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://ds.cominty.com/chat/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 => json_encode([
'etag' => '<string>',
'key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-cominty-token: <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://ds.cominty.com/chat/files"
payload := strings.NewReader("{\n \"etag\": \"<string>\",\n \"key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-cominty-token", "<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://ds.cominty.com/chat/files")
.header("x-cominty-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"etag\": \"<string>\",\n \"key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ds.cominty.com/chat/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-cominty-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"etag\": \"<string>\",\n \"key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"size": 123,
"mimetype": "<string>",
"origin": "user",
"share_links": [
{
"created_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"last_accessed_at": "2023-11-07T05:31:56Z",
"access_count": 123,
"revoked": true,
"expires_at": "2023-11-07T05:31:56Z",
"expired": true,
"protected": true,
"url": "<string>"
}
],
"url": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
A Cominty Platform API secret. A key created now starts with sk-cmt-. Send it as is, or as Bearer sk-cmt-..., with at most one Bearer prefix. A key created before the prefix existed has no sk-cmt- and still works.
Body
application/json