import requests
url = "https://api.diga.io/v1/knowledge/item/text"
payload = {
"name": "<string>",
"content": "<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){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"created_date": "2023-11-07T05:31:56Z",
"status": "indexing",
"category": "txt",
"size_bytes": 123,
"knowledge_base_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content": "<string>"
}Create a knowledge item from raw text content. The text is stored in the database and indexed asynchronously.
import requests
url = "https://api.diga.io/v1/knowledge/item/text"
payload = {
"name": "<string>",
"content": "<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){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"created_date": "2023-11-07T05:31:56Z",
"status": "indexing",
"category": "txt",
"size_bytes": 123,
"knowledge_base_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content": "<string>"
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Successful Response
Unique identifier for the knowledge item
Name of the knowledge item
When the item was created
Current status of the knowledge item
indexing, uploaded, error "txt"Size of the knowledge item content in bytes
ID of the knowledge base this item belongs to, if any
Text content of the knowledge item