[Geoprisma-dev] JSON responses in GeoPrisma

Alexandre Dube adube at mapgears.com
Wed Aug 11 13:52:16 EDT 2010


Here's some more comments about the matter :

   http://trac.osgeo.org/geoprisma/ticket/125#comment:2

Alexandre


On 10-08-10 11:36 AM, Alexandre Dube wrote:
> Hi devs,
>
>   In the following ticket [1], I proposed to be able to query the 
> config using some of its methods.  The result should be returned in 
> JSON.  Before moving on, I think we should agree in a simple JSON 
> structure for the responses received and have a small JSON parser to 
> read it.
>
>   For example, we could have responses like this  :
>
> // sample 1 (when ok)
> {
>     'status': "ok",
>     'response': { /*the json object returned by the query*/ }
> }
>
> // sample 2 (when not ok) :
> {
>     'status': "failure",
>     'response': "the error message"
> }
>
> // sample 3 (or we could also have)
> {
>     'status': "failure",
>     'response' : {},
>     'error': "the error message"
> }
>
> // sample 4 (or also if ok and not)
> {
>     'status': "ok",
>     'response' : {/*the json object returned by the query*/ },
>     'message': "transaction successful"
> }
>
> {
>     'status': "failure",
>     'response' : {},
>     'message': "the error message"
> }
>
>
>
> We could then have a small util .js file where we would define the 
> 'readJSON' methods to read the results of our queries.
>
> What do you think ?
>
> [1] http://trac.osgeo.org/geoprisma/ticket/125
>


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Geoprisma-dev mailing list