[Fiware-lab-help] [Orion] Possible wrong format in errorCode for pagination

Fi-ware ULPGC fiware at ulpgc.es
Mon Nov 24 11:57:22 CET 2014


Testing: Publish/Subscribe Broker - Orion Context Broker
Tested versions:  0.14.0 and 0.16.0
Responsible: fiware at ulpgc.es
Environment: 0.14.0 tested in VM hosted in Fiware Cloud. 0.16.0 tested in
private server.
Description
Using the pagination feature with details param enabled we get an errorCode
like:

XML version
 <errorCode>
    <code>200</code>
    <reasonPhrase>OK</reasonPhrase>
    <details>Count: 322</details>
  </errorCode>

JSON version
"errorCode" : {
    "code" : "200",
    "reasonPhrase" : "OK",
    "details" : "Count: 322"
  }

We have a doubt with the details field, it seems to be a general field and
 it hasn’t a specific format. The “problem” resides in that “Count” isn’t a
field.  For example, if the JSON version is used by  javaScript function,
get the numbers of elements is something like:

//data has the orion response
var elements  =parseInt(data.errorCode.details.replace(“Count: ”.””));

If “Count” could be a property the functions would be something like:

//data has the orion response
var elements  =parseInt(data.errorCode.details.Count);

The second approach may be more coherent with the JSON structure. If
details field could have more information at same time, getting the number
of elements will be harder.

Reading official documentation, actual approach seems to be the desired
behavior.

How to replicate: Use RESTful API for Orion Context Broker and make a
paginated query with “details=on”.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fiware.org/private/fiware-lab-help/attachments/20141124/c56cb1e2/attachment.html>


More information about the Fiware-lab-help mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy