API returns invalid JSON for some branches

Bug #1852034 reported by Jelmer Vernooij
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Launchpad itself
New
Undecided
Unassigned

Bug Description

$ curl https://launchpad.net/~eydev/php-ssh2/trunk

Returns a valid branch page in HTML.

However:

$ curl -D/dev/stdout -H 'Accept: application/json' https://api.launchpad.net/devel/~eydev/php-ssh2/trunk
HTTP/1.1 404 Not Found
...
Object: <lp.systemhomes.WebServiceApplication object at 0x7f6be50abdd0>, name: u'~eydev'

For other branches, I do get back a valid JSON response with this curl command.

Revision history for this message
Michael Kogan (michael-kogan) wrote :

Happens to me with a suspended user as well:

$ curl -H 'Accept: application/json' https://api.launchpad.net/1.0/~9d9
u'User is suspended: ~9d9'

This breaks utilities like https://github.com/johnf/github-issue-importer as the response cannot be parsed.

Changed in launchpad:
status: New → Confirmed
Revision history for this message
William Grant (wgrant) wrote :

Both of those are error responses (a 404 for the branch, and a 410 for the user), with Content-Type: text/plain. It isn't correct to try to parse them as if they were JSON.

Changed in launchpad:
status: Confirmed → Invalid
Jelmer Vernooij (jelmer)
Changed in launchpad:
status: Invalid → New
description: updated
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

The issue Michael mentions is unrelated to the one I'm seeing.

Why am I getting back a 404 on the API side even if the branch exists?

If a 404 is the correct response here, then why is there no API rest endpoint for this branch? And related, what does the error message "Object: <lp.systemhomes.WebServiceApplication object at 0x7f6be50abdd0>, name: u'~eydev'" mean?

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.