API talk:Data formats

From MediaWiki.org
Jump to navigation Jump to search

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 24.218.104.144 (talkcontribs) 21:44, 22 August 2011 (UTC)

JSONP[edit]

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.
87.68.162.236 18:02, 11 February 2014 (UTC)

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)

Compatibility[edit]

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

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)

https://fr.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Fa%C3%A7ade&rvprop=content&format=jsonfm
https://fr.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Fa%C3%A7ade&rvprop=content&format=jsonfm&utf8
Robin Hood  (talk) 21:07, 21 March 2015 (UTC)
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)

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)