Page MenuHomePhabricator

New swagger-ui try it out feature returns 406 for some endpoints
Closed, ResolvedPublic

Description

For some of the endpoints listed in https://en.wikipedia.org/api/rest_v1/#/Page%20content/getFormatRevision2 the "Try it out" feature returns 406 but when the same URL is used in a browser or in curl those return a 200.

Example: /page/html/{title}/{revision}/{tid} endpoint

curl -X GET "https://en.wikipedia.org/api/rest_v1/page/html/Cat/892292867/17bfc8c0-6130-11e9-b2db-b90c06fd84a7" -H "accept: text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/1.7.0""

Expected: 200

Actual response: 406

{
  "type": "https://mediawiki.org/wiki/HyperSwitch/errors/unknown_error",
  "method": "get",
  "uri": "/en.wikipedia.org/v1/page/html/Cat/892292867/17bfc8c0-6130-11e9-b2db-b90c06fd84a7"
}

Screen Shot 2019-04-18 at 8.27.47 PM.png (571×954 px, 65 KB)

Event Timeline

mobrovac added a subscriber: mobrovac.

This is likely a bug in Swagger-UI; there is probably a problem with the Accept header having quotes which are probably not escaped. I'll take a look.

Heh, no, it turns out we have forgotten to update the response profile version in the spec. PR #1122 is the fix.

Mentioned in SAL (#wikimedia-operations) [2019-04-25T19:25:35Z] <mobrovac@deploy1001> Started deploy [restbase/deploy@7187e0c]: Bump HTML content version in docs, remove Parsoid stash fall-back and start logging all sections requests - T221432 T215956 T216636

Mentioned in SAL (#wikimedia-operations) [2019-04-25T19:45:39Z] <mobrovac@deploy1001> Finished deploy [restbase/deploy@7187e0c]: Bump HTML content version in docs, remove Parsoid stash fall-back and start logging all sections requests - T221432 T215956 T216636 (duration: 20m 04s)

mobrovac triaged this task as High priority.

Fix deployed, verified it works. Thanks for reporting @bearND !