Upload Url Items
import requests
url = "https://api.diga.io/v1/knowledge/item/url"
payload = {
"items": [
{
"url": "<string>",
"name": "<string>"
}
],
"knowledge_base_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [{url: '<string>', name: '<string>'}],
knowledge_base_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.diga.io/v1/knowledge/item/url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.diga.io/v1/knowledge/item/url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"url": "<string>",
"name": "<string>"
}
],
"knowledge_base_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.diga.io/v1/knowledge/item/url"
payload := strings.NewReader("{\n \"items\": [\n {\n \"url\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"knowledge_base_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"successful_items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"created_date": "2023-11-07T05:31:56Z",
"url": "<string>",
"category": "url",
"size_bytes": 123,
"knowledge_base_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"failed_items": [
{
"name": "<string>",
"error": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Knowledge Items
Upload Url Items
Index web URLs as knowledge items. Each URL is crawled, parsed, and indexed asynchronously.
POST
/
v1
/
knowledge
/
item
/
url
Upload Url Items
import requests
url = "https://api.diga.io/v1/knowledge/item/url"
payload = {
"items": [
{
"url": "<string>",
"name": "<string>"
}
],
"knowledge_base_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [{url: '<string>', name: '<string>'}],
knowledge_base_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.diga.io/v1/knowledge/item/url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.diga.io/v1/knowledge/item/url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"url": "<string>",
"name": "<string>"
}
],
"knowledge_base_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.diga.io/v1/knowledge/item/url"
payload := strings.NewReader("{\n \"items\": [\n {\n \"url\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"knowledge_base_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"successful_items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"created_date": "2023-11-07T05:31:56Z",
"url": "<string>",
"category": "url",
"size_bytes": 123,
"knowledge_base_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"failed_items": [
{
"name": "<string>",
"error": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Autorizaciones
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Cuerpo
application/json
⌘I

