Validation API
It would be nice to add validation to the REST API. For example, if I added the URL parameter "ve=1" (as opposed to the default ve=0), it would be nice to have the REST API invocation validated with standard error messaging returned. For example:
/space/myspace/connections?q=city:london&me=person:john
Could alternately return:
1) errno= 0, errstatus= "OK"
2) errno= 13, errstatus= "Undefined Space 'myspace'"
3) errno = 21, errstatus= "Invalid query - undefined attribute
'city:london'"
4) errno = 17, errstatus= "Invalid me parameter - invalid memory
category 'person'"
5) ... and so forth
The JSON codes returned could be structured for one error to be
returned or multiple errors. The JSON codes could not only identify
the error code and a textual message, but also the URL parameter
(if appropriate) name, a text offset into the parameter, or some
text that is "near" the issue.
Or perhaps forget the ve=1 parameter and always provide a JSON portion of the response that reports the success of the REST API call.
2 Posted by Jared Peterson on 09 Feb, 2011 02:21 PM
Anthony,
We're already making some slow progress in this area. We're improving our error messages, using HTTP status codes more effectively, and beginning to wrap errors with a standard JSON structure. These changes should move out to most of the API calls over the next few releases.
However, we haven't thought about using a "validation" param. I'll log a ticket so that we can consider that more.
Thanks for the feedback.
Jared
Jared Peterson closed this discussion on 09 Feb, 2011 02:21 PM.
Jared Peterson re-opened this discussion on 09 Feb, 2011 02:21 PM