IBM 云存储对象 S3 的请求和响应格式 API

Request and response format for IBM cloud storage object S3 API

我需要 IBM 云存储对象 S3 的请求和响应格式相关信息 API.I 一直在搜索 API 文档,发现它仅支持 XML 响应 format.Question是,是否支持Json格式响应?如果是,非常感谢提供有关对象的详细信息和支持 APIs,我可以获得 Json 响应。

当前Amazon S3 API is dated 2006-03-01. It encapsulates the metadata in XML documents, not in JSON. The IBM Cloud Object Storage service offers a common subset of the S3 API。为了兼容,API 需要遵循基于 XML 的 Amazon S3 API。

你的问题的答案是没有 JSON 支持,只有 XML。

Henrik 是正确的,因为 S3 API 是基于 XML 的,但是根据所使用的 SDK 或工具,可以获得 JSON、文本或 table 回应。

例如,using the AWS CLI 您可以使用 aws configure 设置响应类型,然后输出将被适当地格式化。

JSON:

$ aws s3api --endpoint-url=https://{endpoint} s3api list-buckets
{
    "Owner": {
        "DisplayName": "{access-key}",
        "ID": "{access-key}"
    },
    "Buckets": [
        {
            "CreationDate": "2016-11-09T16:43:29.957Z",
            "Name": "bucket-1"
        },
        {
            "CreationDate": "2017-06-13T23:47:18.169Z",
            "Name": "bucket-2"
        },
        {
            "CreationDate": "2017-05-01T02:36:34.385Z",
            "Name": "bucket-3"
        },
    ]
}

文本:

$ aws s3api --endpoint-url=https://{endpoint} s3api list-buckets
BUCKETS 2016-11-09T16:43:29.957Z    bucket-1
BUCKETS 2017-06-13T23:47:18.169Z    bucket-2
BUCKETS 2017-05-01T02:36:34.385Z    bucket-3
OWNER   {access-key}    {access-key}

Table:

$ aws s3api --endpoint-url=https://{endpoint} s3api list-buckets
----------------------------------------------------------------------------
|                                ListBuckets                               |
+--------------------------------------------------------------------------+
||                                 Buckets                                ||
|+----------------------------------+-------------------------------------+|
||           CreationDate           |                Name                 ||
|+----------------------------------+-------------------------------------+|
||  2016-11-09T16:43:29.957Z        |  bucket-1                           ||
||  2017-06-13T23:47:18.169Z        |  bucket-2                           ||
||  2017-05-01T02:36:34.385Z        |  bucket-3                           ||
|+----------------------------------+-------------------------------------+|
||                                  Owner                                 ||
|+-----------------------------------+------------------------------------+|
||            DisplayName            |                ID                  ||
|+-----------------------------------+------------------------------------+|
||            {access-key}           |           {access-key}             ||
|+-----------------------------------+------------------------------------+|