Resources Status

Ryan Quam's Avatar

Ryan Quam

09 Apr, 2010 02:36 PM via web

1) (http://docs.saffronsierra.com/Resources-Status) lists rref as the parameter to the individual status call, but the parameter is now rr
2) Using rr and calling the individual status, the response has brackets [] around the JSON array that is not a valid format (stack trace):

Response:[{"rac":"add","rst":"passed","dc":"2010-04-09T13:57:41Z"}]
net.sf.json.JSONException: A JSONObject text must begin with '{' at character 1 of
 [{"rac":"add","rst":"passed","dc":"2010-04-09T13:57:41Z"}]
at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:505)
at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1144)
at net.sf.json.JSONObject._fromString(JSONObject.java:1373)
at net.sf.json.JSONObject.fromObject(JSONObject.java:161)
at net.sf.json.JSONObject.fromObject(JSONObject.java:130)

3) Also, what do all the response fields represent in both response types?

  1. Support Staff 2 Posted by Chet Patel on 09 Apr, 2010 06:20 PM

    Chet Patel's Avatar

    The response is an array with multiple status blocks. You should use a JSONArray object to parse the response string.
    Here is an example.

    [ {

    "rac": "add",
    "rst": "passed",
    "dc": "2010-04-08T14:05:34Z"
    

    }, {

    "rac": "remove",
    "rst": "passed",
    "dc": "2010-04-09T18:20:40Z"
    

    } ]

  2. 3 Posted by Ryan Quam on 09 Apr, 2010 06:45 PM

    Ryan Quam's Avatar

    That works, thanks. Since it always returns one status block, I thought it should be a single object and not an array. Is there a way to query multiple resources to get multiple status blocks returned?

  3. Support Staff 4 Posted by Chet Patel on 09 Apr, 2010 07:14 PM

    Chet Patel's Avatar

    There is an overall status call for resources. '/resources/status'
    It shows the number of resources that are in the following states: 'passed', 'failed', 'working', 'pending' and 'paused' resources.

    { "nps": 993, "nf": 11, "nw": 0, "npd": 0, "npdg": 0 }

  4. 5 Posted by Ryan Quam on 09 Apr, 2010 07:32 PM

    Ryan Quam's Avatar

    I've been using that call as well. I just wondered if there was REST call that I could issue that would a return a response like your sample response (#2) so I could test the handling of multiple status blocks in the JSONArray.

  5. Support Staff 6 Posted by Chet Patel on 09 Apr, 2010 08:27 PM

    Chet Patel's Avatar

    Right now there is no way to retrieve status for multiple resources.
    Just for a single resource, multiple status blocks could be for 'add'
    and 'remove' actions.

  6. Chet Patel closed this discussion on 12 Apr, 2010 03:17 PM.

Comments are currently closed for this discussion. You can start a new one.