A couple of common mistakes while consuming JEMMA REST APIs ...

20 views
Skip to first unread message

Riccardo Tomasi

unread,
Nov 22, 2014, 5:09:10 PM11/22/14
to jemma-...@googlegroups.com
Dear all,

Here a small tip on the safest way to handle UIDs while accessing JEMMA APIs (we thought of publishing this on the ML here because a couple of teams at SHH_2014 had some issue with this).

Remember that according to the OSGi DAL specs are they are currently implemented in JEMMA, there is no limitation on how a device or function UID may look like.

This means:

1) If you are trying  to address some function or device which include in its name either spaces or other forbidden characters, you MUST urlencode it's name before making your http request, for example
    WRONG: GET http://localhost/api/devices/this is my evil device/functions
    CORRECT: GET http://localhost/api/devices/this%20is%20my%20evil%20device/functions

(if you don't do it, you will get most probably risk a 405 error ...)

2) Some UIDs in the hackathon include dots (e.g. this.is.my.nice.device:123 )
    If you are have these kind addresses within some JSON object and you are using some reflective framework to handle it, you may run into problems.
    In order to cope with this issues most frameworks provide associative access -> myjsonobject['this.is.my.nice.device:123'] which you can use instead of -> myjsonobject.this.is.my.nice.device:123)

Hope this helps,

Riccardo
--
---
Riccardo Tomasi
Head of Research Unit: Internet of Things Service Management (IoT-SM)
Pervasive Technologies (PerT) Area
Istituto Superiore Mario Boella (ISMB)
tel. (+39) 011.2276.438
skype: riccardo1981 [My calendar] [Linkedin] [Disclaimer]
Reply all
Reply to author
Forward
0 new messages