AddCategory
Creates a category in a specified workspace to classify and manage files. Each workspace supports a maximum of 500 categories.
Usage notes
- Data tables cannot be added by calling an API. To add data tables, go to the Application Data page in the console.
- A RAM user must first obtain the API permissions for Alibaba Cloud Model Studio (the
AliyunBailianDataFullAccesspolicy, which includes the sfm:AddCategory permission) and join a workspace before calling this operation. An Alibaba Cloud account can call this operation directly without authorization. We recommend that you call this operation by using the latest version of the Alibaba Cloud Model Studio SDK. - This operation is not idempotent.
Throttling: This operation is subject to throttling if called frequently. Do not exceed 5 calls per second. If a request is throttled, try again later.
Try it out
You can call this operation in OpenAPI Explorer without calculating a signature. After a successful call, OpenAPI Explorer can automatically generate SDK code examples.
Authorization information
The following table describes the authorization information of the API. You can use it in the Action element of RAM permission policy statements to grant RAM users or RAM roles the permission to call this API. The details are as follows:
-
Action: the specific permission point.
-
Access level: the access level of each action. Valid values: Write, Read, and List.
-
Resource type: the resource types that support authorization for the action. The details are as follows:
- Required resource types are marked with a prefixed asterisk (*).
- For operations that do not support resource-level authorization,
All Resourcesis used.
-
Condition key: the condition keys defined by the cloud service itself.
-
Dependent actions: the other permissions required to successfully perform the operation. The caller must have the permissions of all dependent actions for the operation to succeed.
Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
sfm:AddCategory | create | *All Resources
| None | None |
Request syntax
POST /{WorkspaceId}/datacenter/category/ HTTP/1.1
Path parameters
Name | Type | Required | Description | Example |
|---|---|---|---|---|
| WorkspaceId | string | Yes | The ID of the workspace in which the category is created. For information about how to obtain a workspace ID, see Work with workspaces. | llm-3z7uw7fwz0vxxxx |
Request parameters
Name | Type | Required | Description | Example |
|---|---|---|---|---|
| CategoryName | string | Yes | The name of the category. The name must be 1 to 20 characters in length and can contain characters in the Unicode letter category (including English letters, Chinese characters, and digits). It can also contain half-width colons (:), underscores (_), periods (.), and hyphens (-). | Product list |
| CategoryType | string | Yes | The type of the category. Valid values:
| UNSTRUCTURED |
| ParentCategoryId | string | No | The ID of the parent category. The new category is created under the parent category. If this parameter is left empty, a first-level category is created. | cate_cdd11b1b79a74e8bbd675c356a91ee3xxxxxxxx |
| ConnectorId | string | No | The ID of the data connector (Connector) instance to which the category belongs. You can obtain the ID from the Alibaba Cloud Model Studio console. | conn_xxxx |
Response parameters
Name | Type | Description | Example |
|---|---|---|---|
object | Schema of Response | ||
| Code | string | The error status code. | success |
| Data | object | The business data fields of the API response. | |
| CategoryId | string | The category ID. Keep this value secure, as it is used in all subsequent API operations related to this category. | cate_cdd11b1b79a74e8bbd675c356a91ee3xxxxxxxx |
| CategoryName | string | The name of the category. | Category name |
| Message | string | The error message. | Requests throttling triggered. |
| RequestId | string | The request ID. | 778C0B3B-xxxx-5FC1-A947-36EDD13606AB |
| Status | string | The status code returned by the API. | 200 |
| Success | boolean | Indicates whether the API call is successful. Valid values:
| true |
Examples
Sample success response
JSON format
{
"Code": "success",
"Data": {
"CategoryId": "cate_cdd11b1b79a74e8bbd675c356a91ee3xxxxxxxx",
"CategoryName": "Category name"
},
"Message": "Requests throttling triggered.",
"RequestId": "778C0B3B-xxxx-5FC1-A947-36EDD13606AB",
"Status": "200",
"Success": true
}
Error codes
For more error codes, see Error Center.
Change history
For more information, see Change details.