Page MenuHomePhabricator

[REST API] unable to set accept-language for /page/summary/ endpoint
Closed, InvalidPublic

Description

I'm having trouble with the /page/summary/{title} endpoint of the REST API at /api/rest_v1

Long story short, I'm trying to request specific language variants from wikipedias that could serve different dialects to the same url (ex: sr.wikipedia.org can render in raw Serbian, or in latinized Serbian sr_el, and zh.wikipedia.org can render Simplified Chinese zh_CN or Traditional Chinese zh_TW)

However, even though there is ostensibly an Accept-Language header param in the API that should be the way to set it, (based on past discussion in T122942), using it doesn't seem to actually do anything.

For example, even with the example provided in docs at https://sr.wikipedia.org/api/rest_v1/#!/Page_content/get_page_summary_title, running Accept-Language sr-el still gives back the raw Serbian:

Same story if I call the API myself instead of through the UI in the docs: https://codepen.io/anon/pen/zyNVbq

(basically, I only ever get the extract as seen in https://sr.wikipedia.org/sr/%D0%88%D1%83%D1%82%D1%98%D1%83%D0%B1, not https://sr.wikipedia.org/sr-el/%D0%88%D1%83%D1%82%D1%98%D1%83%D0%B1)

I've also tried this with "zh-tw", "tw", "zh-TW" and "zh_TW" for zh.wikipedia.org, but I only ever get Simplified Chinese in the response.

(compare https://zh.wikipedia.org/zh-cn/%E7%B4%90%E7%B4%84%E5%AE%A2 and https://zh.wikipedia.org/zh-tw/%E7%B4%90%E7%B4%84%E5%AE%A2)

What's going on here? Why isn't the Accept-Language param working?

Event Timeline

Restricted Application added subscribers: Petar.petkovic, Cosine02, Aklapper. · View Herald TranscriptDec 20 2018, 10:14 PM
Madepossiblebyviewerslikeyou renamed this task from [REST API] unable to set accept-language to [REST API] unable to set accept-language for /page/summary/ endpoint.Dec 20 2018, 10:18 PM
Pchelolo closed this task as Invalid.

Currently, Serbian is the only language where variants are supported. All the rest of the languages are on their way (Chineese)

I've just tried your example for Serbian both via the doc UI and via curl - both work as expected for me. Please reopen if you are still experiencing the issue.