Create Knowledge Folder
curl --request POST \
--url https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"parent_id": "<string>"
}
'import requests
url = "https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders"
payload = {
"name": "<string>",
"parent_id": "<string>"
}
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({name: '<string>', parent_id: '<string>'})
};
fetch('https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders', 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-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders",
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>',
'parent_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"parent_id\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"parent_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"parent_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": 123,
"updated_at": 123,
"knowledge_id": "<string>",
"parent_ids": [
"<string>"
],
"folder_id": "<string>",
"type": "folder",
"parent_id": "",
"name": "",
"original_name": "",
"location": "",
"path": "",
"source_location": "",
"size": 0,
"source_type": "tencent, web",
"complete_flag": 0
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Knowledge
Create Knowledge Folder
创建一个知识库目录
POST
/
v1
/
knowledge
/
{knowledge_id}
/
folders
Create Knowledge Folder
curl --request POST \
--url https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"parent_id": "<string>"
}
'import requests
url = "https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders"
payload = {
"name": "<string>",
"parent_id": "<string>"
}
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({name: '<string>', parent_id: '<string>'})
};
fetch('https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders', 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-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders",
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>',
'parent_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"parent_id\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"parent_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-spectra.duplik.cn/v1/knowledge/{knowledge_id}/folders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"parent_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": 123,
"updated_at": 123,
"knowledge_id": "<string>",
"parent_ids": [
"<string>"
],
"folder_id": "<string>",
"type": "folder",
"parent_id": "",
"name": "",
"original_name": "",
"location": "",
"path": "",
"source_location": "",
"size": 0,
"source_type": "tencent, web",
"complete_flag": 0
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
用户ID
Body
application/json
Response
Successful Response
Maximum string length:
20Parent folder ID list
folder, pdf, txt ...
Maximum string length:
128Maximum string length:
20Maximum string length:
255file original name
Maximum string length:
255Maximum string length:
1024Maximum string length:
1024Maximum string length:
1024File byte size
Maximum string length:
128Complete flag, 0: init, 1: complete
