Create and manage a Service Object

Define a device, register it and retrieve its descriptor.

These examples document the original platform. Use your own deployment; this website does not provide the former hosted API or account service.

This is the simplest way to get data published on servIoTicy, or to access others’ public data also.

servIoTicy API reference available at docs.servioticy.com

API REFERENCE

Create a Service Object Descriptor

A Service Object is the basic building block for working with data in servIoTicy. It is the virtual counterpart of a physical device (either directly connected to the web or accessible through a gateway). It can be used to publish data generated by the device, to retrieve data stored in servIoTicy, or even to initiate actuations on the devices.

All the details of the Service Object descriptor format can be found in this section, but here you have a simple working example to start with!

so.json
{
    "name": "Phone",
    "description": "COMPOSE phone",
    "URL": "Web Object URL ",
    "streams": {
        "position": {
            "channels": {
                "location": {
                    "type": "geo_point",
                    "unit": "degrees"
                }
            },
            "description": "GPS outdoor location",
            "type": "sensor"
        }
    },
    "customFields": {},
    "actions": [],
    "properties": []
}

Register a new Service Object in servIoTicy

This process registers the Service Object in the servIoTicy platform, and makes it usable once it has been succesfully deployed.

You need to provide your API KEY (you can find it in your the section “My Account” once you log in in the servIoTicy portal) and the previously created Service Object description.

Create Service Object - curl
curl -i -X POST -H "Content-Type: application/json" \
-H "Authorization: YOUR_API_TOKEN" \
-d @so.json http://api.servioticy.com/

IMPORTANT! On success, you will receive a response code informing you about your Service Object ID (SOID). You will need this SOID to interact with your newly created Service Object in the future!

Response create Service Object - curl
HTTP/1.1 201 Created
Date: Wed, 05 Mar 2014 15:57:20 GMT
Server: api.servIoTicy
Location: http://api.servioticy.com/139403523318497be978754164c27b07e748b53079662
Content-Type: application/json
Transfer-Encoding: chunked

{"id":"139403523318497be978754164c27b07e748b53079662","createdAt":1394035233184}

Retrieve the list of Service Objects you own

You created a Service Object and you forgot its SOID? No problem, you can use this call to retrieve all your Service Objects in a second…

Use this call…

Getting all the Service Objects - curl
curl -i -H "Authorization: YOUR_API_TOKEN" \
http://api.servioticy.com

…and get your list of SOIDs!

Response getting all the Service Objects - curl
HTTP/1.1 200 OK
Date: Wed, 05 Mar 2014 16:24:17 GMT
Server: api.servIoTicy
Content-Type: application/json
Transfer-Encoding: chunked

["1394032968019a03882a2f1b24cac809ab82c2cfebbc8","13940351714098e77253c401543e9aeb21feabf9e101c","139403523318497be978754164c27b07e748b53079662"]

Retrieve the description of a Service Object

You can always retrieve the description of previously created Service Object. You only need your API TOKEN and the SOID of the Service Object.

Use this call to retrieve the description…

Getting a Service Object - curl
curl -i -H "Authorization: YOUR_API_TOKEN" \
http://api.servioticy.com/139403523318497be978754164c27b07e748b53079662

… and this is what you get back!

Response getting a Service Object - curl
HTTP/1.1 200 OK
Date: Wed, 05 Mar 2014 16:18:20 GMT
Server: api.servIoTicy
Content-Type: application/json
Transfer-Encoding: chunked

{"id":"139403523318497be978754164c27b07e748b53079662","public":"false","createdAt":1396521151696,"updatedAt":1396521151696,"name":"Phone","description":"COMPOSE phone","URL":"Web Object URL ","streams":{"position":{"channels":{"location":{"type":"geo_point","unit":"degrees"}},"description":"GPS outdoor location","type":"sensor"}},"customFields":{},"actions":[],"properties":[]}