CreateNamespace

更新时间:
复制 MD 格式

Creates a namespace in a table bucket. A namespace is a logical grouping for organizing and managing tables.

Usage notes

  • Namespace names must be unique within a table bucket.

  • A namespace name must be 1 to 255 characters long and can contain only lowercase letters, digits, and underscores (_). It cannot start or end with an underscore or be prefixed with oss, acs, aliyun, alibaba, or aws.

  • The destination table bucket must exist before you create a namespace.

Permissions

API

Action

Description

CreateNamespace

oss:CreateNamespace

Creates a namespace.

Request syntax

PUT /namespaces/{tableBucketARN} HTTP/1.1
Content-type: application/json
Host: cn-hangzhou.oss-tables.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

{
   "namespace": ["string"]
}

Request parameters

Parameter

Type

Required

Example

Description

tableBucketARN

string

Yes

acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket

The ARN of the table bucket in the format acs:osstables:{region}:{accountId}:bucket/{bucketName}.

namespace

array

Yes

["my_namespace"]

An array of namespace names. Only one namespace per request is supported. The name must be 1 to 255 characters long and can contain only lowercase letters, digits, and underscores (_). It cannot start or end with an underscore or be prefixed with oss, acs, aliyun, alibaba, or aws.

Response parameters

Parameter

Type

Example

Description

namespace

array

["my_namespace"]

An array of the created namespace names.

tableBucketARN

string

acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket

The ARN of the table bucket that owns the namespace.

Examples

Request example

PUT /namespaces/acs%3Aosstables%3Acn-hangzhou%3A1234567890%3Abucket%2Fmy-table-bucket HTTP/1.1
Content-type: application/json
Host: cn-hangzhou.oss-tables.aliyuncs.com
Date: Thu, 10 Apr 2025 08:00:00 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/osstables/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c****


{
   "namespace": ["my_namespace"]
}

Response example

HTTP/1.1 200 OK
Server: AliyunOSS
x-oss-request-id: 5C06A3B67B8B5A3DA422****
x-oss-server-time: 3
Content-Type: application/json


{
   "namespace": ["my_namespace"],
   "tableBucketARN": "acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket"
}

SDKs

CreateNamespace is available in the following SDKs:

ossutil CLI

The equivalent ossutil command is create-namespace.

Error codes

Error code

HTTP status code

Description

BadRequestException

400

The request is invalid or malformed.

ForbiddenException

403

The caller lacks permission for this request.

NotFoundException

404

The requested resource does not exist.

ConflictException

409

The specified namespace already exists.