From 4ec77e56646729941b15f724b7f1125c65a478f3 Mon Sep 17 00:00:00 2001 From: hallgren Date: Sat, 17 Nov 2012 17:42:30 +0000 Subject: [PATCH] GF web service API examples: update examples of the browse command Also some style tweaks. --- src/www/minibar/gf-web-api-examples.html | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/www/minibar/gf-web-api-examples.html b/src/www/minibar/gf-web-api-examples.html index ae1a69c9e..d2ddc6fc9 100644 --- a/src/www/minibar/gf-web-api-examples.html +++ b/src/www/minibar/gf-web-api-examples.html @@ -3,22 +3,20 @@ GF web services API examples + + -

GF web services API examples

+

+ GF web services API examples

GF can be used interactively from the GF Shell. Some of the functionality availiable in the GF shell is also available via the GF web services API. @@ -153,6 +152,16 @@ full API.
server.browse({id:"This"},callback)
http://localhost:41296/grammars/Foods.pgf?command=browse&id=This&format=json
{"def":"fun This : Kind -> Item","producers":[],"consumers":[]} +
// Get info about all categories and functions in the abstract syntax +
server.browse({},callback) +
http://localhost:41296/grammars/Foods.pgf?command=browse&format=json +
{"cats":{"Kind":{"def":"cat Kind", + "producers":["Cheese","Fish","Mod","Pizza","Wine"], + "consumers":["Mod","That","These","This","Those"]}, + ...}, + "funs":{"This":{"def":"fun This : Kind -> Item","producers":[],"consumers":[]}, + ...} +}
// Convert an abstract syntax tree to JSON
server.pgf_call("abstrjson",{tree:"Pred (That Pizza) (Very Boring)"},callback) @@ -165,6 +174,6 @@ full API.
-Last modified: Sat Nov 17 12:53:47 CET 2012 +Last modified: Sat Nov 17 18:40:55 CET 2012
TH