Async REST API operations don't return 'Location' header

Bug #1654629 reported by Tony Espy
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd
Triaged
Medium
Unassigned

Bug Description

Per the snapd REST API documentation on the wiki [1], when an async operation returns the status code 202, a 'Location' reply header should be provided that specifies the URL ( /v2/changes/{change-id-from-reply}) to be used to retrieve the operation's actual status.

This is being reported against snapd version 2.20, installed on a xenial desktop.

~$ sudo curl -D - -X POST -H "Content-Type: application/json" -d '{"action":"install"}' --unix-socket /run/snapd.socket 'http:/v2/snaps/tpm'
HTTP/1.1 202 Accepted
Content-Type: application/json
Date: Fri, 06 Jan 2017 18:36:05 GMT
Content-Length: 82

{"type":"async","status-code":202,"status":"Accepted","result":null,"change":"29"}

[1] https://github.com/snapcore/snapd/wiki/REST-API

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Also note the "null" result that is returned. This seems like it should either be omitted or be {}.

Changed in snappy:
status: New → Confirmed
Revision history for this message
Michael Vogt (mvo) wrote :
Changed in snappy:
importance: Undecided → Medium
status: Confirmed → Triaged
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

I suggest fixing the documentation instead of adding a Location header. We already provide the necessary data in the response. If the argument is avoiding parsing the response, that's not a great idea as it'll mean errors will also not be reported properly.

Michael Vogt (mvo)
affects: snappy → snapd
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.