Creates a video category. A maximum of three category levels can be created. Each category can contain up to 100 subcategories.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes AddCategory

The operation that you want to perform. Set the value to AddCategory.

CateName String Yes Funny

The name of the category.

  • The value can be up to 64 bytes in length.
  • The string must be encoded in the UTF-8 format.
ParentId Long No 1000126088

The ID of the parent category. If you do not set this parameter, a level 1 category is generated by default. The parent category ID of a level 1 category is -1.

Note Level 1 material categories are built in the system and cannot be changed. If you set the Type parameter to material, you must set the ParentId parameter.
Type String No default

The type of the category. Valid values:

  • default (default): default category
  • material: material category

Response parameters

Parameter Type Example Description
RequestId String 25818875-5F78-4A*****F6-D7393642CA58

The ID of the request.

Category Struct

The information about the video category.

CateId Long 100200304

The ID of the video category.

CateName String Movie

The name of the category.

  • The value can be up to 64 bytes in length.
  • The string must be encoded in the UTF-8 format.
Level Long 0

The level of the category. A value of 0 indicates a level 1 category.

ParentId Long -1

The ID of the parent category. The parent category ID of a level 1 category is -1.

Type String default

The type of the category. Valid values:

  • default (default): default category
  • material: material category

Examples

Sample requests

https://vod.aliyuncs.com/?Action=AddCategory
&CateName=Funny
&<Common request parameters>

Sample success responses

XML format

<AddCategoryResponse>
      <Category>
            <ParentId>-1</ParentId>
            <Type>default</Type>
            <Level>0</Level>
            <CateName>Movie</CateName>
            <CateId>100200304</CateId>
      </Category>
      <RequestId>25818875-5F78-4A*****F6-D7393642CA58</RequestId>
</AddCategoryResponse>

JSON format

{
    "Category": {
        "ParentId": "-1",
        "Type": "default",
        "Level": "0",
        "CateName": "Movie",
        "CateId": "100200304"
    },
    "RequestId": "25818875-5F78-4A*****F6-D7393642CA58"
}

Error codes

For a list of error codes, visit the API Error Center.

Common errors

The following table describes the common errors that this operation can return.

Error code

Error message

HTTP status code

Description

LevelExceededMax

The level of categories exceeded maximum.

400

The error message returned because the number of category levels exceeds the upper limit.

SubTotalExceededMax

The total of sub categories exceeded maximum.

400

The error message returned because the number of subcategories exceeds the upper limit.

InvalidCateId.NotFound

The CateId not exist.

404

The error message returned because the specified ID of the parent category does not exist.

SDK examples

We recommend that you use a server SDK to call this operation. For more information about the sample code that is used to call this operation in various languages, see the following topics: