Criar anexo a partir de uma mídia
curl --request POST \
--url https://api.nuvia.ai/v1/knowledge/{id}/attachment \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nuvia.ai/v1/knowledge/{id}/attachment"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nuvia.ai/v1/knowledge/{id}/attachment', 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://api.nuvia.ai/v1/knowledge/{id}/attachment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nuvia.ai/v1/knowledge/{id}/attachment"
req, _ := http.NewRequest("POST", url, nil)
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://api.nuvia.ai/v1/knowledge/{id}/attachment")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nuvia.ai/v1/knowledge/{id}/attachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"extension": "<string>",
"external_url": "<string>",
"file_type": "IMAGE",
"company": "<unknown>",
"_id": "<string>",
"s3_key": "<string>",
"meta": {
"mimeType": "<string>",
"size": 123,
"fileName": "<string>",
"resourceUrl": "<string>"
},
"createdAt": "<unknown>",
"updatedAt": "<unknown>"
}Base de Conhecimento
Criar anexo a partir de uma mídia
Cria um attachment que aponta para o arquivo de uma mídia (type=MEDIA) da central, sem subir o arquivo de novo. Devolve o mesmo formato de POST /resource/upload-attachment; use o _id no envio de mensagem ou na resposta rápida. Mídia inexistente ou de outra empresa responde 404 com code: KNOWLEDGE_MEDIA_NOT_FOUND.
POST
/
v1
/
knowledge
/
{id}
/
attachment
Criar anexo a partir de uma mídia
curl --request POST \
--url https://api.nuvia.ai/v1/knowledge/{id}/attachment \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nuvia.ai/v1/knowledge/{id}/attachment"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nuvia.ai/v1/knowledge/{id}/attachment', 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://api.nuvia.ai/v1/knowledge/{id}/attachment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nuvia.ai/v1/knowledge/{id}/attachment"
req, _ := http.NewRequest("POST", url, nil)
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://api.nuvia.ai/v1/knowledge/{id}/attachment")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nuvia.ai/v1/knowledge/{id}/attachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"extension": "<string>",
"external_url": "<string>",
"file_type": "IMAGE",
"company": "<unknown>",
"_id": "<string>",
"s3_key": "<string>",
"meta": {
"mimeType": "<string>",
"size": 123,
"fileName": "<string>",
"resourceUrl": "<string>"
},
"createdAt": "<unknown>",
"updatedAt": "<unknown>"
}Cabeçalhos
Resposta
Attachment criado a partir da mídia