Call the OpenMetaQuery operation to enable metadata management for a bucket and select a retrieval mode. OSS creates a metadata index library, builds indexes for all objects in the bucket, and performs near-real-time incremental scans for new objects.
Notes
-
By default, an Alibaba Cloud account has permission to enable metadata management. To use a RAM user, grant the
oss:OpenMetaQuerypermission. Grant custom permissions to a RAM user.
Request syntax
POST /?metaQuery&comp=add&mode=basic HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValueRequest headers
This operation uses only Common request headers.
Request elements
|
Name |
Type |
Required |
Example |
Description |
|
mode |
String |
Yes |
basic |
The retrieval mode. Valid values:
|
|
role |
String |
No |
my-oss-role |
The RAM role name for accessing OSS. You can grant permissions to the role in the console to ensure secure access. |
Response headers
The response contains only common response headers. For more information, see Common response headers.
Examples
Request example
POST /?metaQuery&comp=add&mode=basic HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Thu, 17 Apr 2025 13:08:38 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218eResponse example
HTTP/1.1 200 OK
x-oss-request-id: 5C1B138A109F4E405B2D****
Date: Mon, 26 Jul 2021 13:08:38 GMT
Content-Length: 0
Connection: keep-alive
Server: AliyunOSS
x-oss-request-id: 5C06A3B67B8B5A3DA422299D
x-oss-server-time: 544
SDK
Supported SDKs:
ossutil
The corresponding ossutil command is open-meta-query.