Page MenuHomePhabricator

Selected response type in REST BASE page does not match the info sent in request, resulting in 406 error
Closed, ResolvedPublic

Description

Exploring REST API age and trying to get html for a page gives 406 error.
For example:
https://en.wikipedia.org/api/rest_v1/#!/Page_content/get_page_html_title
Select Main_Page as title and then press "try it out"
Error code of 406 is returned.

It is because, the response content selected by default is text/html, where as the curl request if formatted for another option as given below.
curl -X GET --header 'Accept: application/problem+json' 'https://en.wikipedia.org/api/rest_v1/page/html/Main_Page'

Changing the response content to application/problem+json and then trying it successfully gives html as the curl request that is sent is accepted
curl -X GET --header 'Accept: text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/2.1.0"' 'https://en.wikipedia.org/api/rest_v1/page/html/Main_Page'

Please change the response content selection to match the curl request.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 6 2019, 7:31 AM

This seem to be a bug in swagger-ui. We're going to update to the latest upstream version of the package, so it should be resolved when done.

mobrovac closed this task as Resolved.May 30 2019, 7:49 AM
mobrovac claimed this task.
mobrovac added a subscriber: mobrovac.

We have switched to the new swagger-ui version and OpenAPI v3. If you perceive the problem again, please reopen.