From c007dbdc13e4d54fe24611d4d3b77f031e4eb20b Mon Sep 17 00:00:00 2001 From: KVOJJJin Date: Wed, 11 Oct 2023 21:03:36 +0800 Subject: [PATCH] Feat: add document of authorization (#1311) --- .../datasets/template/template.en.mdx | 254 ++++++++++-------- .../datasets/template/template.zh.mdx | 254 ++++++++++-------- .../develop/template/template.en.mdx | 19 ++ .../develop/template/template.zh.mdx | 19 ++ .../develop/template/template_chat.en.mdx | 19 ++ .../develop/template/template_chat.zh.mdx | 19 ++ 6 files changed, 348 insertions(+), 236 deletions(-) diff --git a/web/app/(commonLayout)/datasets/template/template.en.mdx b/web/app/(commonLayout)/datasets/template/template.en.mdx index 7e207d9c35..7e109f897f 100644 --- a/web/app/(commonLayout)/datasets/template/template.en.mdx +++ b/web/app/(commonLayout)/datasets/template/template.en.mdx @@ -2,127 +2,23 @@ import { CodeGroup } from '@/app/components/develop/code.tsx' import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '@/app/components/develop/md.tsx' # Dataset API -
-
- - - - ### Request Body - - - Dataset name - - - - - - ```bash {{ title: 'cURL' }} - curl --location --request POST '${apiBaseUrl}/v1/datasets' \ - --header 'Authorization: Bearer {api_key}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "name": "name" - }' - ``` - - - ```json {{ title: 'Response' }} - { - "id": "", - "name": "name", - "description": null, - "provider": "vendor", - "permission": "only_me", - "data_source_type": null, - "indexing_technique": null, - "app_count": 0, - "document_count": 0, - "word_count": 0, - "created_by": "", - "created_at": 1695636173, - "updated_by": "", - "updated_at": 1695636173, - "embedding_model": null, - "embedding_model_provider": null, - "embedding_available": null - } - ``` - - - ---- +
+ ### Authentication + + Service API of Dify authenticates using an `API-Key`. + + It is suggested that developers store the `API-Key` in the backend instead of sharing or storing it in the client side to avoid the leakage of the `API-Key`, which may lead to property loss. + + All API requests should include your `API-Key` in the **`Authorization`** HTTP Header, as shown below: + + + ```javascript + Authorization: Bearer {API_KEY} - - - - ### Query - - - Page number - - - Number of items returned, default 20, range 1-100 - - - - - - ```bash {{ title: 'cURL' }} - curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \ - --header 'Authorization: Bearer {api_key}' ``` - - - ```json {{ title: 'Response' }} - { - "data": [ - { - "id": "", - "name": "name", - "description": "desc", - "permission": "only_me", - "data_source_type": "upload_file", - "indexing_technique": "", - "app_count": 2, - "document_count": 10, - "word_count": 1200, - "created_by": "", - "created_at": "", - "updated_by": "", - "updated_at": "" - }, - ... - ], - "has_more": true, - "limit": 20, - "total": 50, - "page": 1 - } - ``` - - - + +
--- @@ -329,6 +225,128 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from --- + + + + ### Request Body + + + Dataset name + + + + + + ```bash {{ title: 'cURL' }} + curl --location --request POST '${apiBaseUrl}/v1/datasets' \ + --header 'Authorization: Bearer {api_key}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "name": "name" + }' + ``` + + + ```json {{ title: 'Response' }} + { + "id": "", + "name": "name", + "description": null, + "provider": "vendor", + "permission": "only_me", + "data_source_type": null, + "indexing_technique": null, + "app_count": 0, + "document_count": 0, + "word_count": 0, + "created_by": "", + "created_at": 1695636173, + "updated_by": "", + "updated_at": 1695636173, + "embedding_model": null, + "embedding_model_provider": null, + "embedding_available": null + } + ``` + + + + +--- + + + + + ### Query + + + Page number + + + Number of items returned, default 20, range 1-100 + + + + + + ```bash {{ title: 'cURL' }} + curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \ + --header 'Authorization: Bearer {api_key}' + ``` + + + ```json {{ title: 'Response' }} + { + "data": [ + { + "id": "", + "name": "name", + "description": "desc", + "permission": "only_me", + "data_source_type": "upload_file", + "indexing_technique": "", + "app_count": 2, + "document_count": 10, + "word_count": 1200, + "created_by": "", + "created_at": "", + "updated_by": "", + "updated_at": "" + }, + ... + ], + "has_more": true, + "limit": 20, + "total": 50, + "page": 1 + } + ``` + + + + +--- + -
- - - - ### Request Body - - - 数据集名称 - - - - - - ```bash {{ title: 'cURL' }} - curl --location --request POST '${props.apiBaseUrl}/datasets' \ - --header 'Authorization: Bearer {api_key}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "name": "name" - }' - ``` - - - ```json {{ title: 'Response' }} - { - "id": "", - "name": "name", - "description": null, - "provider": "vendor", - "permission": "only_me", - "data_source_type": null, - "indexing_technique": null, - "app_count": 0, - "document_count": 0, - "word_count": 0, - "created_by": "", - "created_at": 1695636173, - "updated_by": "", - "updated_at": 1695636173, - "embedding_model": null, - "embedding_model_provider": null, - "embedding_available": null - } - ``` - - - ---- +
+ ### 鉴权 + + Dify Service API 使用 `API-Key` 进行鉴权。 + + 建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。 + + 所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示: + + + ```javascript + Authorization: Bearer {API_KEY} - - - - ### Query - - - 页码 - - - 返回条数,默认 20,范围 1-100 - - - - - - ```bash {{ title: 'cURL' }} - curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \ - --header 'Authorization: Bearer {api_key}' ``` - - - ```json {{ title: 'Response' }} - { - "data": [ - { - "id": "", - "name": "数据集名称", - "description": "描述信息", - "permission": "only_me", - "data_source_type": "upload_file", - "indexing_technique": "", - "app_count": 2, - "document_count": 10, - "word_count": 1200, - "created_by": "", - "created_at": "", - "updated_by": "", - "updated_at": "" - }, - ... - ], - "has_more": true, - "limit": 20, - "total": 50, - "page": 1 - } - ``` - - - + +
--- @@ -329,6 +225,128 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from --- + + + + ### Request Body + + + 数据集名称 + + + + + + ```bash {{ title: 'cURL' }} + curl --location --request POST '${props.apiBaseUrl}/datasets' \ + --header 'Authorization: Bearer {api_key}' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "name": "name" + }' + ``` + + + ```json {{ title: 'Response' }} + { + "id": "", + "name": "name", + "description": null, + "provider": "vendor", + "permission": "only_me", + "data_source_type": null, + "indexing_technique": null, + "app_count": 0, + "document_count": 0, + "word_count": 0, + "created_by": "", + "created_at": 1695636173, + "updated_by": "", + "updated_at": 1695636173, + "embedding_model": null, + "embedding_model_provider": null, + "embedding_available": null + } + ``` + + + + +--- + + + + + ### Query + + + 页码 + + + 返回条数,默认 20,范围 1-100 + + + + + + ```bash {{ title: 'cURL' }} + curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \ + --header 'Authorization: Bearer {api_key}' + ``` + + + ```json {{ title: 'Response' }} + { + "data": [ + { + "id": "", + "name": "数据集名称", + "description": "描述信息", + "permission": "only_me", + "data_source_type": "upload_file", + "indexing_technique": "", + "app_count": 2, + "document_count": 10, + "word_count": 1200, + "created_by": "", + "created_at": "", + "updated_by": "", + "updated_at": "" + }, + ... + ], + "has_more": true, + "limit": 20, + "total": 50, + "page": 1 + } + ``` + + + + +--- + + ### Authentication + + Service API of Dify authenticates using an `API-Key`. + + It is suggested that developers store the `API-Key` in the backend instead of sharing or storing it in the client side to avoid the leakage of the `API-Key`, which may lead to property loss. + + All API requests should include your `API-Key` in the **`Authorization`** HTTP Header, as shown below: + + + ```javascript + Authorization: Bearer {API_KEY} + + ``` + + + +--- + + ### 鉴权 + + Dify Service API 使用 `API-Key` 进行鉴权。 + + 建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。 + + 所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示: + + + ```javascript + Authorization: Bearer {API_KEY} + + ``` + + + +--- + + ### Authentication + + Service API of Dify authenticates using an `API-Key`. + + It is suggested that developers store the `API-Key` in the backend instead of sharing or storing it in the client side to avoid the leakage of the `API-Key`, which may lead to property loss. + + All API requests should include your `API-Key` in the **`Authorization`** HTTP Header, as shown below: + + + ```javascript + Authorization: Bearer {API_KEY} + + ``` + + + +--- + + ### 鉴权 + + Dify Service API 使用 `API-Key` 进行鉴权。 + + 建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。 + + 所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示: + + + ```javascript + Authorization: Bearer {API_KEY} + + ``` + + + +--- +