API talk:Data formats

From mediawiki.org
Latest comment: 7 years ago by Green Cardamom in topic UTF8 encoding

pageid vs page in json format[edit]

Why does the json format have the pageid for the element name instead of a fix name like "page" along the lines of the other formats? This makes it exceedingly annoying to use data contracts and other automation to generate classes for manipulating the data. — Preceding unsigned comment added by (talkcontribs) 21:44, 22 August 2011 (UTC)Reply[reply]


By any chance, will there be a JSONP version for the format available by default for all GET-related features (not using an extension or a third side website)? This will be so useful if you're collecting information from other related wikis or in a sub domain of your wiki. 18:02, 11 February 2014 (UTC)Reply[reply]

If the format of the request is JSON, you can also add &callback=functionName to get the data as JSONP. There is some more information about it here. Deuterium (talk) 09:40, 19 April 2014 (UTC)Reply[reply]


Does format=xml work in 1.8 as well? --Nemo 18:06, 25 June 2014 (UTC)Reply[reply]

How to set UTF-8 parameter[edit]

Could anyone post an example how the parameter for UTF-8 encoding has to be set? Thanks!--Mischa004 (talk) 18:44, 21 March 2015 (UTC)Reply[reply]

Robin Hood  (talk) 21:07, 21 March 2015 (UTC)Reply[reply]
Apparently it's better form to specify utf= for a boolean "true" API request parameter in HTTP requests. Without the =, the browser may omit the parameter, particularly in a POSTed request. I will add a section about boolean request parameters to this page, some day. -- SPage (WMF) (talk) 22:00, 11 May 2015 (UTC)Reply[reply]

UTF8 encoding[edit]

The doc says for utf8 some characters will not be UTF8 encoded. Which characters will not be encoded? -- Green Cardamom (talk) 01:26, 1 December 2016 (UTC)Reply[reply]