Hi!
I'm very new to Mediawiki and trying to build a wiki site. I plan to use it
as part of a server for mobile app, so I want JSON. I'm using Semantic
MediaWiki(SMW) and have added some attributes to several pages, and now I
have trouble make SMW return those data in JSON. There are 2 questions:
1. How to make a short url to return all attributes on a certain page? That
is:
{{#ask [[Page title]]
| ?attr1
| ?attr2
}}
The current way is to use special:ask, but with all those parameters it's
too long to be a good api I think...
2. JSON returned by SMW has many information I don't want, such
as printrequests and the serializer. I just want those attributes. What I
want is something like this:
{ title: "Page title", attr1: "value1", attr2: "value2" }
Can I get such a clean JSON by using SMW? Also, link=none seems don't work
on json format?
Maybe my requirements are a little complicated. So I'm also wondering if I
can make a formatter for myself. It may meet all the two points above, and
is very flexible. Or use a new php and post requests in it to the
mediawiki's special:ask page, get the returned JSON, decode and encode(only
useful things), and return the result. But I think there must be better way
to do it, without sending another request to the same server. So what's the
best way to solve these?
Waiting for help.
Thanks!
Zhenwei Wu