Help talk:API

From semantic-mediawiki.org
Jump to: navigation, search

Contents

Thread titleRepliesLast modified
askargs: units of measurement404:43, 25 December 2014
Limit and offset not working?110:06, 13 November 2014
Incomplete documentation106:14, 27 October 2014

askargs: units of measurement

How can I add needed unit of measurement to a printout in {{#askargs:}}? Also, how can I format a date there?

Alexander Mashintalk05:53, 11 November 2014

It's even worse. It seems that all export features {{#askargs:}}, {{#ask:}}, csv and json formats simply ignore # in printouts (only showing units of measurement in the "printrequests").

Alexander Mashintalk11:03, 13 November 2014

So, I have to convert units of measurements in my client application again, although it could have ben done by SMW. The application should know the conversion rates etc.

But even that is made difficult. The required units (when shown at all) are not in the query.results [(label)].printouts objects but in the query.printrequests. Moreover, while query.results [(label)].printouts is an object, query.printrequests is an array, so I cannot just go there and get the unit, I have to traverse the array at least once to convert in to an object with the same indices as query.results [(label)].printouts. Why? Why? Why?

I have to parse JSON, which is supposed to be parsed already, in dozens of lines of code; just because there is no sane way to get quantities in needed units in the API, or at least, it is not documented.

Alexander Mashintalk12:01, 18 November 2014

I suspect you are right that the ask API does not support units. You should be able to use Special:Ask though. And enhancements to the ask API, or its documentation, are certainly welcome.

Jeroen De Dauw (talk)10:01, 24 December 2014

My task was to make a fully dynamic (not cached with the rest of the wikipage) semantic map. At first I used SMW API and had to process units of measurement in my JavaScript. Then I found a more universal and robust solution: I developed an extension that enables server- and client-side inclusions on wikipages (with api.php?action=parse). So, this issue is not so pressing to me now. However, I still think that there is a bug in the API, not its documentation.

Alexander Mashintalk04:43, 25 December 2014
 
 
 
 

Limit and offset not working?

SMW 2.0 MW 1.23.5

It seeps support for the parameters argument is gone? if you try &parameters=limit%3D10 the API responds with "Unrecognized parameter: 'parameters'", it doesn't support continue parameter either? Is there a new method for query continue with ask API as the documented methods do not work?

Karl pietsch (talk)07:01, 13 November 2014

Incomplete documentation

If there are two limiting conditions in the ask query, e.g. [[Modification date::+]] [[Revision id::>20000]] what should they look like in the conditions field of the AJAX query URL?

Alexander Mashintalk16:55, 24 October 2014

Already found out: in ask, space-separated enclosed in [[]], in askargs, |-separated without brackets.

Alexander Mashintalk17:10, 24 October 2014