### What problem does this PR solve?
Aims to stop the process of parsing.
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
RAGFlow offers RESTful APIs for you to integrate its capabilities into third-party applications.
Base URL
http://<host_address>/v1/api/
Dataset URL
http://<host_address>/api/v1/dataset
Authorization
All of RAGFlow's RESTFul APIs use API key for authorization, so keep it safe and do not expose it to the front end.
Put your API key in the request header.
Authorization: Bearer {API_KEY}
To get your API key:
In RAGFlow, click Chat tab in the middle top of the page.
Hover over the corresponding dialogue >Chat Bot API to show the chatbot API configuration page.
Click Api Key>Create new key to create your API key.
Copy and keep your API key safe.
Create dataset
This method creates (news) a dataset for a specific user.
Request
Request URI
Method
Request URI
POST
/dataset
:::note
You are required to save the data.dataset_id value returned in the response data, which is the session ID for all upcoming conversations.
:::
Request parameter
Name
Type
Required
Description
dataset_name
string
Yes
The unique identifier assigned to each newly created dataset. dataset_name must be less than 2 ** 10 characters and cannot be empty. The following character sets are supported: - 26 lowercase English letters (a-z) - 26 uppercase English letters (A-Z) - 10 digits (0-9) - "_", "-", "."
{"code":"RetCode.DATA_ERROR","message":"The file test_data/imagination.txt does not exist"}
Response for nonexistent dataset
{"code":102,"message":"Can't find this dataset"}
Response for the number of files exceeding the limit
{"code":102,"message":"You try to upload 512 files, which exceeds the maximum number of uploading files: 256"}
Response for uploading without files.
{"code":101,"message":"None is not string."}
Delete documents
This method deletes documents for a specific user.
Request
Request URI
Method
Request URI
DELETE
/dataset/{dataset_id}/documents/{document_id}
Request parameter
Name
Type
Required
Description
dataset_id
string
Yes
The ID of the dataset. Call 'GET' /dataset to retrieve the ID.
document_id
string
Yes
The ID of the document. Call 'GET' /document to retrieve the ID.
Response
Successful response
{"code":0,"data":true,"message":"success"}
Response for deleting a document that does not exist
{"code":102,"message":"Document 111 not found!"}
Response for deleting documents from a non-existent dataset
{"code":101,"message":"The document f7aba1ec379b11ef8e853043d7ee537e is not in the dataset: 000, but in the dataset: f7a7ccf2379b11ef83223043d7ee537e."}
List documents
This method lists documents for a specific user.
Request
Request URI
Method
Request URI
GET
/dataset/{dataset_id}/documents
Request parameter
Name
Type
Required
Description
dataset_id
string
Yes
The ID of the dataset. Call 'GET' /dataset to retrieve the ID.
offset
int
No
The start of the listed documents. Default: 0
count
int
No
The total count of the listed documents. Default: -1, meaning all the later part of documents from the start.
order_by
string
No
Default: create_time
descend
bool
No
The order of listing documents. Default: True
keywords
string
No
The searching keywords of listing documents. Default: ""