[Attempto] JSON-RPC for AceWiki
Tobias Kuhn
kuhntobias at gmail.com
Fri Dec 30 10:42:00 CET 2011
Hi,
Thanks for sharing!
I started a wiki page on GitHub for brainstorming on the data and action
model for AceWiki:
https://github.com/AceWiki/AceWiki/wiki/Data-and-Action-Model
Regards,
Tobias
On 25.12.2011 11:49, Changyuan Yu wrote:
> Hi,
> I implement a simple json-rpc servlet for AceWiki. Compare to
> previous RESTful api, json-rpc can be directly mapped to java method,
> which make implementation much easier. And I think, before data and
> action model(see https://github.com/AceWiki/AceWiki/issues/9) for
> AceWiki is defined, we can not map RESTful operation to AceWiki
> operation.
>
> The only two method current implemented is "list" and "get". The
> method "list" take no argument and will return a list of objects which
> contains article id, words and type. Below is an example return of
> "list()":
>
> {"result"=>
> [{"words"=>[], "id"=>0, "type"=>"mainpage"},
> {"words"=>["apple", "apples"], "id"=>1, "type"=>"Noun"},
> {"words"=>["fruit", "fruits"], "id"=>2, "type"=>"Noun"},
> {"words"=>["Apple1", "Apple1", "Apple1", "Apple1"],
> "id"=>3,
> "type"=>"Proper Name"}],
> "id"=>"1",
> "jsonrpc"=>"2.0"}
>
> The method "get" take 3 argument: the article id, the language and
> whether include answer, and will return the content of an article.
> Below is an example return of "get(0, null, true)":
>
> {"result"=>
> {"headwords"=>["Main Page"],
> "words"=>[],
> "language"=>"Default",
> "statements"=>
> [{"integrated"=>true,
> "reasonable"=>true,
> "text"=>"Apple1 is an apple.",
> "type"=>"sentence"},
> {"integrated"=>true,
> "reasonable"=>false,
> "text"=>"What is a fruit?",
> "type"=>"question",
> "answers"=>["Apple1"]}]},
> "id"=>"1",
> "jsonrpc"=>"2.0"}
>
>
> If anyone is interested in test himself, please goto
> https://github.com/yuchangyuan/AceWiki/tree/json-rpc to get the source
> code.
>
More information about the attempto
mailing list