Skip to content

ListCategory

Retrieves the details of one or more categories in a specified workspace.

Operation description

  • API calls to query structured data tables are not supported.

  • A RAM user must obtain database permissions for Alibaba Cloud Model Studio and be added to a workspace before calling this API operation. The AliyunBailianDataFullAccess permission, which includes the sfm:ListCategory permission point, is required. An Alibaba Cloud account can call this API operation directly without authorization. You can use the latest version of the Alibaba Cloud Model Studio SDK to call this API operation.

  • When you perform a paged query, set MaxResults to specify the number of entries to return on the first page. The NextToken value in the response is the token for the next page. To query a subsequent page, set the NextToken parameter to the value from the previous response and specify MaxResults. If NextToken is empty, all results have been returned.

  • This API operation is idempotent.

Throttling: Frequent calls to this API operation are throttled. Do not exceed a frequency of 5 calls per second. If a call is throttled, retry the call later.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage. Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (***** ) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

ActionAccess levelResource typeCondition keyDependent action
sfm:ListCategorylist*All Resource *NoneNone

Request syntax

HELPCODEESCAPE-plaintext
POST /{WorkspaceId}/datacenter/categories HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
WorkspaceIdstringYesThe workspace ID. For more information, see Use workspaces.ws_3Nt27MYcoK191ISp
CategoryTypestringYesThe type of the category to query. Valid values: - UNSTRUCTURED: unstructured category. ** **Note ** API calls to query structured data tables are not supported.UNSTRUCTURED
ParentCategoryIdstringNoThe ID of the parent category.cate_cdd11b1b79a74e8bbd675c356a91ee3XXXXXXXX
NextTokenstringNoThe query token. Set this parameter to the NextToken value returned from the previous API call.AAAAAdH70eOCSCKtacdomNzak4U=
MaxResultsintegerNoThe number of categories to return on each page. Valid values: 1 to 200. Default value: 20. If you set this parameter to a value greater than 200, the value is automatically set to 200.20
CategoryNamestringNoFilters the returned category list by category name. This parameter performs an exact match. By default, this parameter is empty, which means that filtering by category name is disabled.产品清单

Response elements

ParameterTypeDescriptionExample
objectThe response schema.
CodestringThe error status code.success
DataobjectThe business data fields of the API operation.
CategoryListarrayThe list of categories.
objectThe category object.
CategoryIdstringThe category ID.cate_cdd11b1b79a74e8bbd675c356a91ee3XXXXXXXX
CategoryNamestringThe category name.类目1
CategoryTypestringThe category type. Possible values: - UNSTRUCTURED: unstructured category.UNSTRUCTURED
IsDefaultbooleanIndicates whether the category is the default category. Possible values: - true: The category is the default category. - false: The category is not the default category. Default categories cannot be deleted.true
ParentCategoryIdstringThe ID of the parent category.cate_addd11b1b79a74e8bbd675c356a91ee3XXXXXXXX
HasNextbooleanIndicates whether a next page of data exists. Possible values: - true: Yes. - false: No.true
MaxResultsintegerThe number of categories returned on each page.20
NextTokenstringThe query token returned from this call.AAAAALHWGpGoYCcYMxiFfmlhvh7Z4G8jiXR6IjHYd+M9WQVJ
TotalCountintegerThe total number of categories returned.20
MessagestringThe error message.workspace id is null or invalid.
RequestIdstringThe request ID.17204B98-xxxx-4F9A-8464-2446A84821CA
StatusstringThe status code returned by the API operation.200
SuccessbooleanIndicates whether the call was successful. Possible values: - true: The call was successful. - false: The call failed.true

Examples

Success response

JSON format

HELPCODEESCAPE-json
{
  "Code": "success",
  "Data": {
    "CategoryList": [
      {
        "CategoryId": "cate_cdd11b1b79a74e8bbd675c356a91ee3XXXXXXXX",
        "CategoryName": "类目1",
        "CategoryType": "UNSTRUCTURED",
        "IsDefault": true,
        "ParentCategoryId": "cate_addd11b1b79a74e8bbd675c356a91ee3XXXXXXXX"
      }
    ],
    "HasNext": true,
    "MaxResults": 20,
    "NextToken": "AAAAALHWGpGoYCcYMxiFfmlhvh7Z4G8jiXR6IjHYd+M9WQVJ",
    "TotalCount": 20
  },
  "Message": "workspace id is null or invalid.",
  "RequestId": "17204B98-xxxx-4F9A-8464-2446A84821CA",
  "Status": "200",
  "Success": true
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.

Mirror of Alibaba Cloud Model Studio docs for reference and RAG. Not affiliated with Alibaba Cloud.