Ask Your Question

List image with params as limit = 1 using XML interface is returning an extra tag

asked 2013-03-15 07:11:37 -0600

harika-vakadi gravatar image

While trying to list images using filter as limit = 1 (

The xml response is returning an extra tag "<atom:link href=";marker=8e6f2a43-5a6c-459f-8e0f-d72808c6ea06" rel="next"/>"

XML Response:

<images xmlns:atom="" xmlns=""><image name="cirros-0.3.1-x86_64-uec" id="8e6f2a43-5a6c-459f-8e0f-d72808c6ea06"><atom:link href="" rel="self"/><atom:link href="" rel="bookmark"/><atom:link href="" type="application/vnd.openstack.image" rel="alternate"/></image><atom:link href=";marker=8e6f2a43-5a6c-459f-8e0f-d72808c6ea06" rel="next"/></images>

The result of parse the above body to JSON is as below

XML_parse_body = [{'name': 'cirros-0.3.1-x86_64-uec', 'links': [{'href': '', 'rel': 'self'}, {'href': '', 'rel': 'bookmark'}, {'href': '', 'type': 'application/vnd.openstack.image', 'rel': 'alternate'}], 'id': '8e6f2a43-5a6c-459f-8e0f-d72808c6ea06'}, {'href': '', 'rel': 'next'}]

len(XML_parse_body) = 2 Hence the lenght is resulting as "2" but not 1

Where as in the case of JSON response it is as below JSON_resp_body = [{u'id': u'8e6f2a43-5a6c-459f-8e0f-d72808c6ea06', u'links': [{u'href': u'', u'rel': u'self'}, {u'href': u'', u'rel': u'bookmark'}, {u'href': u'', u'type': u'application/vnd.openstack.image', u'rel': u'alternate'}], u'name': u'cirros-0.3.1-x86_64-uec'}]

len(JSON_resp_body) = 1

This is resulting a failure in execution of test case (list images with filters) for both XML and JSON interfaces simultaneously.

Can any one please clarify on this ASAP?

It is as expected in the case of list images with details

url = (

XML Response

<images xmlns:os-dcf="" xmlns:os-ext-img-size="" xmlns:atom="" xmlns=""><image status="ACTIVE" updated="2013-03-01T15:52:38Z" name="cirros-0.3.1-x86_64-uec" created="2013-03-01T15:52:37Z" mindisk="0" progress="100" minram="0" id="8e6f2a43-5a6c-459f-8e0f-d72808c6ea06" os-ext-img-size:size="25165824"><metadata><meta key="kernel_id">906e734d-95aa-4acb-bee0-4eff2fc73f30</meta><meta key="ramdisk_id">edafffbf-8a90-4d06-84a0-7e32f98655b8</meta></metadata><atom:link href="" rel="self"/><atom:link href="" rel="bookmark ... (more)

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2013-03-29 09:13:16 -0600

harika-vakadi gravatar image

Thanks Giampaolo Lauria, that solved my question.

edit flag offensive delete link more

answered 2013-03-26 15:43:38 -0600

lauria gravatar image

This is really working as designed. The extra tag is supposed t be there as it is explained in the doc here: (

"For convenience, collections are required to contain atom "next" links. They may optionally also contain "previous" links. The last page in the list will not contain a "next" link. The following examples illustrate three pages in a collection of images. The first page was retrieved via a GET to ( . In these examples, the limit parameter sets the page size to a single item. Subsequent links will honor the initial page size. Thus, a client may follow links to traverse a paginated collection without having to input the marker parameter. "

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2013-03-15 07:11:37 -0600

Seen: 112 times

Last updated: Mar 29 '13