Belge oluştur
curl --request POST \
--url https://app.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"type": "<string>",
"url": "<string>",
"links": [
{
"link": "<string>"
}
],
"relative_links_limit": 123
}
'import requests
url = "https://app.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents"
payload = {
"name": "<string>",
"description": "<string>",
"type": "<string>",
"url": "<string>",
"links": [{ "link": "<string>" }],
"relative_links_limit": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
type: '<string>',
url: '<string>',
links: [{link: '<string>'}],
relative_links_limit: 123
})
};
fetch('https://app.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents', 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.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents",
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([
'name' => '<string>',
'description' => '<string>',
'type' => '<string>',
'url' => '<string>',
'links' => [
[
'link' => '<string>'
]
],
'relative_links_limit' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"type\": \"<string>\",\n \"url\": \"<string>\",\n \"links\": [\n {\n \"link\": \"<string>\"\n }\n ],\n \"relative_links_limit\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"type\": \"<string>\",\n \"url\": \"<string>\",\n \"links\": [\n {\n \"link\": \"<string>\"\n }\n ],\n \"relative_links_limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"type\": \"<string>\",\n \"url\": \"<string>\",\n \"links\": [\n {\n \"link\": \"<string>\"\n }\n ],\n \"relative_links_limit\": 123\n}"
response = http.request(request)
puts response.read_body{
"message": "Document created successfully. Processing will begin shortly.",
"data": {
"id": 1,
"name": "Company Website",
"description": "Main website content",
"type": "website",
"type_label": "Website",
"status": "processing",
"status_label": "Processing",
"created_at": "2025-01-08T10:30:00.000000Z"
}
}
{
"message": "Document created successfully. Processing will begin shortly.",
"data": {
"id": 2,
"name": "Product Manual",
"description": "User guide for our product",
"type": "pdf",
"type_label": "PDF",
"status": "processing",
"status_label": "Processing",
"created_at": "2025-01-08T10:35:00.000000Z"
}
}
{
"error": "Knowledgebase not found."
}
{
"message": "A file is required for this document type.",
"errors": {
"file": [
"A file is required for this document type."
]
}
}
{
"error": "Failed to create document. Please try again."
}
Bilgi Tabanları
Belge oluştur
Bir bilgi bankasına yeni belge ekleyin
POST
/
user
/
knowledgebases
/
{knowledgebaseId}
/
documents
Belge oluştur
curl --request POST \
--url https://app.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"type": "<string>",
"url": "<string>",
"links": [
{
"link": "<string>"
}
],
"relative_links_limit": 123
}
'import requests
url = "https://app.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents"
payload = {
"name": "<string>",
"description": "<string>",
"type": "<string>",
"url": "<string>",
"links": [{ "link": "<string>" }],
"relative_links_limit": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
type: '<string>',
url: '<string>',
links: [{link: '<string>'}],
relative_links_limit: 123
})
};
fetch('https://app.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents', 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.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents",
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([
'name' => '<string>',
'description' => '<string>',
'type' => '<string>',
'url' => '<string>',
'links' => [
[
'link' => '<string>'
]
],
'relative_links_limit' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"type\": \"<string>\",\n \"url\": \"<string>\",\n \"links\": [\n {\n \"link\": \"<string>\"\n }\n ],\n \"relative_links_limit\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"type\": \"<string>\",\n \"url\": \"<string>\",\n \"links\": [\n {\n \"link\": \"<string>\"\n }\n ],\n \"relative_links_limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.whattalk.ai/api/user/knowledgebases/{knowledgebaseId}/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"type\": \"<string>\",\n \"url\": \"<string>\",\n \"links\": [\n {\n \"link\": \"<string>\"\n }\n ],\n \"relative_links_limit\": 123\n}"
response = http.request(request)
puts response.read_body{
"message": "Document created successfully. Processing will begin shortly.",
"data": {
"id": 1,
"name": "Company Website",
"description": "Main website content",
"type": "website",
"type_label": "Website",
"status": "processing",
"status_label": "Processing",
"created_at": "2025-01-08T10:30:00.000000Z"
}
}
{
"message": "Document created successfully. Processing will begin shortly.",
"data": {
"id": 2,
"name": "Product Manual",
"description": "User guide for our product",
"type": "pdf",
"type_label": "PDF",
"status": "processing",
"status_label": "Processing",
"created_at": "2025-01-08T10:35:00.000000Z"
}
}
{
"error": "Knowledgebase not found."
}
{
"message": "A file is required for this document type.",
"errors": {
"file": [
"A file is required for this document type."
]
}
}
{
"error": "Failed to create document. Please try again."
}
Bu endpoint, bir bilgi bankasında yeni belge oluşturur. Belgeler eşzamansız olarak işlenir - endpoint hemen yanıt dönerken işleme arka planda devam eder.
Yol Parametreleri
integer
gerekli
Bilgi bankasının benzersiz tanımlayıcısı
İstek Gövdesi
string
gerekli
Belgenin adı (maksimum 255 karakter)
string
Belgenin isteğe bağlı açıklaması (maksimum 255 karakter)
string
gerekli
Belge türü:
website, pdf, txt veya docxWeb Sitesi Belgeleri
string
Taranacak ana URL.
links sağlanmadıysa zorunludur.array
Taranacak belirli URL’lerin dizisi.
url sağlanmadıysa zorunludur.Göster bağlantı özellikleri
Göster bağlantı özellikleri
string
gerekli
Belgeye dahil edilecek geçerli bir URL
integer
varsayılan:"10"
Tarama sırasında takip edilecek maksimum bağıl bağlantı sayısı (1-50)
Dosya Belgeleri (PDF, TXT, DOCX)
file
gerekli
Yüklenecek dosya (maksimum 20MB).
multipart/form-data kodlaması kullanın.Yanıt
string
Başarı mesajı
object
Oluşturulan belge nesnesi
{
"message": "Document created successfully. Processing will begin shortly.",
"data": {
"id": 1,
"name": "Company Website",
"description": "Main website content",
"type": "website",
"type_label": "Website",
"status": "processing",
"status_label": "Processing",
"created_at": "2025-01-08T10:30:00.000000Z"
}
}
{
"message": "Document created successfully. Processing will begin shortly.",
"data": {
"id": 2,
"name": "Product Manual",
"description": "User guide for our product",
"type": "pdf",
"type_label": "PDF",
"status": "processing",
"status_label": "Processing",
"created_at": "2025-01-08T10:35:00.000000Z"
}
}
{
"error": "Knowledgebase not found."
}
{
"message": "A file is required for this document type.",
"errors": {
"file": [
"A file is required for this document type."
]
}
}
{
"error": "Failed to create document. Please try again."
}
Belge Türleri
| Tür | Açıklama | Girdi |
|---|---|---|
website | Web sayfalarını tarar ve metin içeriğini çıkarır | URL veya URL listesi |
pdf | PDF dosyalarından metin çıkarır | PDF dosya yüklemesi |
txt | Düz metin içeriği | TXT dosya yüklemesi |
docx | Word belgelerinden metin çıkarır | DOCX dosya yüklemesi |
Örnek: Web Sitesi Belgesi Oluşturma
curl -X POST https://app.whattalk.ai/api/user/knowledgebases/1/documents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Company Website",
"description": "Main website content",
"type": "website",
"url": "https://example.com",
"relative_links_limit": 20
}'
Örnek: PDF Belgesi Yükleme
curl -X POST https://app.whattalk.ai/api/user/knowledgebases/1/documents \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "name=Product Manual" \
-F "description=User guide for our product" \
-F "type=pdf" \
-F "file=@/path/to/document.pdf"
Belge işleme eşzamansızdır. İşlemenin tamamlanıp tamamlanmadığını kontrol etmek için belge getir endpoint’ini sorgulayın.
⌘I

