Launchpad logo and name.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index ][Thread Index ]

[Launchpad-users] Updating bugs with the API



Hi,

I'm trying to update bugs in Launchpad using the API, but every time I issue a PATCH call on api.staging.launchpad.net, it returns either a "400 Bad Request", or a "401 Bad Request".

I'm not using the Python library, but rather direct HTTP calls. Here's an example:

-----------------------------------------------------------------
$ openssl s_client -connect api.staging.launchpad.net:443
CONNECTED(00000003)
[openssl stuff snipped]

PATCH /1.0/entomologist2/+bug/733006 HTTP/1.0
Host: api.staging.launchpad.net
Authentication: OAuth [oauth snipped but the tokens are valid]
Content-Type: application/json
Accept-Language: en-US,*
User-Agent: Mozilla/5.0
Content-Length: 27

{ "status" : "Incomplete" }
-----------------------------------------------------------------

And it returns with:

-----------------------------------------------------------------
HTTP/1.1 400 Bad Request
Date: Sat, 19 Mar 2011 18:28:48 GMT
Server: squid/2.7.STABLE7
Content-Type: text/html
Content-Length: 2185
X-Squid-Error: ERR_INVALID_REQ 0
X-Cache: MISS from arsenic.canonical.com
X-Cache-Lookup: NONE from arsenic.canonical.com:3128
Via: 1.0 arsenic.canonical.com:3128 (squid/2.7.STABLE7)
Via: 1.0 wildcard.staging.launchpad.net
Vary: Accept-Encoding
Connection: close

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd";> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>ERROR: The requested URL could not be retrieved</title> <style type="text/css"><!-- %l body :lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; } :lang(he) { direction: rtl; float: right; } --></style> </head><body> <div id="titles"> <h1>ERROR</h1> <h2>The requested URL could not be retrieved</h2> </div> <hr> <div id="content"> <p><b>Invalid Request</b> error was encountered while trying to process the request:</p> <blockquote id="data"> <pre>PATCH /1.0/entomologist2/+bug/733006 HTTP/1.1
Host: api.staging.launchpad.net
Authentication: OAuth [snipped again]
Content-Type: application/json
Accept-Language: en-US,*
User-Agent: Mozilla/5.0
Via: 1.0 wildcard.staging.launchpad.net
X-Forwarded-For: 83.171.187.250
X-Forwarded-Host: api.staging.launchpad.net
X-Forwarded-Server: wildcard.staging.launchpad.net
Connection: Keep-Alive
Content-Length: 27

{ &quot;status&quot; : &quot;Incomplete&quot; }</pre> </blockquote> <p>Some possible problems are:</p> <ul> <li><p>Missing or unknown request method.</p></li> <li><p>Missing URL.</p></li> <li><p>Missing HTTP Identifier (HTTP/1.0).</p></li> <li><p>Request is too large.</p></li> <li><p>Content-Length missing for POST or PUT requests.</p></li> <li><p>Illegal character in hostname; underscores are not allowed.</p></li> </ul> <p>Your cache administrator is <a href="mailto:webmaster%W";>webmaster</a>.</p> <br> </div> <hr> <div id="footer"> <p>Generated Sat, 19 Mar 2011 18:28:48 GMT by arsenic.canonical.com (squid/2.7.STABLE7)</p> <!-- ERR_INVALID_REQ --> </div> </body></html> closed
-----------------------------------------------------------------------------

This happens if I use openssl to connect to the server directly, or if I use QNetworkAccessManager to issue a PATCH call directly. What am I doing wrong here? A GET call returns the information as the documentation says it should.

Thanks,
Matt

--
Matt Barringer, Software Engineer
SUSE Linux Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
http://susestudio.com                 http://www.novell.com/linux


This is the launchpad-users mailing list archive — see also the general help for Launchpad.net mailing lists.

(Formatted by MHonArc.)