Project

General

Profile

Actions

Bug #10746

closed

RGW swift API: Need to support an alternative way of specifying the format of response.

Added by Dmytro Yurchenko about 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Normal
Target version:
-
% Done:

0%

Source:
other
Tags:
Backport:
Regression:
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

According to http://docs.openstack.org/api/openstack-object-storage/1.0/content/GET_showAccountDetails__v1__account__storage_account_services.html
Request section describes a header Accept as follows: Instead of using the format query parameter, set this header to application/json, application/xml, or text/xml.

So the response format may be specified in two ways.

First way is to set format value in query string:

$ curl -i "http://localhost:8000/swift/v1?format=json" -X GET -H "X-Auth-Token: $token" 
HTTP/1.1 200 OK
Content-type: application/json; charset=utf-8
Content-Length: 39

[{"name":"cont1","count":2,"bytes":28}]

$ curl -i "http://localhost:8000/swift/v1?format=xml" -X GET -H "A-Auth-Token: $token" 
HTTP/1.1 200 OK
Content-type: application/xml; charset=utf-8
Content-Length: 131

<?xml version="1.0" encoding="UTF-8"?><account><container><name>cont1</name><count>2</count><bytes>28</bytes></container></account>

But an alternative way to tell the format by setting a header does not work:

$ curl -i "http://localhost:8000/swift/v1" -X GET -H "X-Auth-Token: $token" -H "Accept: application/json" 
HTTP/1.1 200 OK
Content-type: text/plain; charset=utf-8
Content-Length: 6

cont1

$ curl -i "http://localhost:8000/swift/v1" -X GET -H "X-Auth-Token: $token" -H "Accept: text/xml" 
HTTP/1.1 200 OK
Content-type: text/plain; charset=utf-8
Content-Length: 6

cont1

Actions #2

Updated by Dmytro Yurchenko about 9 years ago

  • Assignee set to Dmytro Yurchenko
Actions #3

Updated by Dmytro Yurchenko about 9 years ago

  • Status changed from New to Fix Under Review
Actions #4

Updated by Yehuda Sadeh about 9 years ago

  • Status changed from Fix Under Review to Resolved
Actions

Also available in: Atom PDF