将文档上传到图书馆
开发环境
http://dev-cn.your-api-server.com
开发环境
http://dev-cn.your-api-server.com
POST
https://api.ai21.com/studio/v1/library/files
回复200
da13301a-14e4-4487-aa2f-cc6048e73cdc // file-uuid
错误:不支持的文档类型422
{
"detail": "Invalid file type: {fileType}. Supported file types are: text/plain"
}
错误:相同的文件名、相同的路径422
{
"detail": "File: {fileName} already exists",
"suggestion": "To override the file content, delete it first using the DELETE endpoint"
}
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.ai21.com/studio/v1/library/files' \
--header 'Content-Type: application/json' \
--data-raw '{
"file ": "string",
"path ": "string",
"labels ": "string",
"publicUrl ": "string"
}'
响应示例响应示例
{
"detail": "Invalid file type: {fileType}. Supported file types are: text/plain"
}
请求参数
Body 参数application/json