Seluxit Platform Open API documentation

Methods

GET

The method GET is used to retrieve data from the database.

PUT

The method PUT is usually used to update the database.

POST

The method POST is used to add new objects and start a new session.

DELETE

The method DELETE is used to remove objects from the database.

Required header for REST calls

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session id>

where <session id> is the session ID obtained by creating a new session.

Retrieve an object by its ID

To retrieve an object, you need to use GET it in the following way

GET <server>:<port>/services/<object type>/<object id>

The API will return the JSON of the object.

Example

Assume that we want to retrieve the information of the Device with ID 2b412da8-9506-4fe6-ada7-c2625c3c95ef. Then we use:

GET <server>:<port>/services/device/2b412da8-9506-4fe6-ada7-c2625c3c95ef

The API will return a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:device-1.0",
  ":id": "2b412da8-9506-4fe6-ada7-c2625c3c95ef",
  "name": "DONGLE",
  "manufacturer": "Seluxit",
  "product": "1-Gateway",
  "version": "1-2.5.0-1.2.1-4668-1.0.2",
  "serial": "3034F8EE90155B4000000021",
  "protocol": "Lemonbeat",
  "communication": "Always Online",
  "included": "1",
  "status": [list statuses],
  "service": [list services],
  "configuration": [list configurations]
}

Retrieve a list of available objects

To retrieve a list of available objects, we need to make a distinction in relation if the searched objects have a parent or not. To understand the objects’ hierarchy we recall their hierarchy.

Retrieve a list of available objects with a parent

To retrieve a list of available objects of one type, use the following command:

GET <server>:<port>/services/<parent type>/<parent id>/<object type>

The API will return the following JSON.

{
  ":type": "urn:seluxit:xml:bastard:idlist-1.0",
  ":id": <parent id>,
  "id": [list children],
  "@type": "urn:seluxit:xml:bastard:<object type>-1.0"
}

Example

An example can be useful to understand better what we mean with <parent type>, <parent id> and <object type>.

Assume that we want to find all the available devices in our network and we know that the our network ID is "607f07a0-7739-455b-962b-7669d6a7f083". This means that our <parent type> is "network", our <parent id> is "607f07a0-7739-455b-962b-7669d6a7f083" and our <object type> is "device".

To obtain our list we need to use: GET <server>:<port>/services/network/607f07a0-7739-455b-962b-7669d6a7f083/device

And the API will return:

{
  ":type": "urn:seluxit:xml:bastard:idlist-1.0",
  ":id": "607f07a0-7739-455b-962b-7669d6a7f083",
  "id": [
    "1cda3f63-90a6-40f2-9df0-05e979cfb3d1",
    "a0bcba60-d3ea-11e5-94df-001a65001500",
    "de554bd0-dfbb-11e5-879e-001a65001500"
  ],
  "@type": "urn:seluxit:xml:bastard:device-1.0"
}

Retrieve a list of available objects without a parent

To retrieve a list of available objects at the top of a hierarchy (as Locations), you need to GET it in the following way

GET <server>:<port>/services/<object type>

The API will return the following JSON.

{
  ":type": "urn:seluxit:xml:bastard:idlist-1.0",
  ":id": null,
  "id": [list objects],
  "@type": "urn:seluxit:xml:bastard:<object type>-1.0"
}

Example

We want to find all the available locations. This means that our <object type> is "location".

To find our locations we need to use: GET <server>:<port>/services/location

And the API will return:

{
  ":type": "urn:seluxit:xml:bastard:idlist-1.0",
  ":id": null,
  "id": [
    "2a1db798-c991-42ba-97bd-782356bf41ed",
    "9cfc6031-5011-4ae0-90c4-509235cc4e43",
    "d4df23d4-31fe-4fb0-bf60-8144337eba95"
  ],
  "@type": "urn:seluxit:xml:bastard:location-1.0"
}

Update an object

To update an object, you need to use PUT it in the following way.

PUT <server>:<port>/services/<object type>/<object id>

with the following body:

{
  ":type": "urn:seluxit:xml:bastard:<object type>-1.0",
  <updated JSON>
}

The API will return the JSON of the object.

Example

Assume that we want to update the name of the Location with ID 37dea70c-1782-44ad-87f1-911fc7555a37. Then we use:

PUT <server>:<port>/services/location/37dea70c-1782-44ad-87f1-911fc7555a37

with the following Body:

{
  ":type": "urn:seluxit:xml:bastard:location-1.0",
  "name": "NewName"
}

The API will update the Location with the new JSON and it will return a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:location-1.0",
  ":id": "37dea70c-1782-44ad-87f1-911fc7555a37",
  "name": "NewName",
  "network": [],
  "user": [],
  "shape": [],
  "stream": [],
  "group": []
}

Information from log

To retrieve information from a log, you need to PUT it in the following way

PUT <server>:<port>/services/log/<log id>

with the following body:

{
    ":type": "urn:seluxit:xml:bastard:log-1.0",
    "type": <type>,
    "timestamp": <datetime>
}

where <type> is one of these strings: "Hour", "Day", "Week", "Month", "Year", "Raw". <datetime> is a timestamp in format iso8601. In relation of the type selected, the API will retrieve different RDD data:

  • "Hour" returns a maximum of 60 data with interval of 1 minute
  • "Day" returns a maximum of 24 data with interval of 1 hour
  • "Week" returns a maximum of 7 data with interval of 1 day
  • "Month" returns a maximum of 28, 29, 30 or 31 data, in relation on the month, with interval of 1 day
  • "Year" returns a maximum of 12 data with interval of 30 days
  • "Raw" returns all the data collected in one hour.

Note: The NaN values are ignored.

Example

In this example we want to retrieve the week Log a45994d8-f742-11e5-b327-577c8d294329. To do so we use the method:

PUT <server>:<port>/services/log/a45994d8-f742-11e5-b327-577c8d294329

{
    ":type": "urn:seluxit:xml:bastard:log-1.0",
    "type": "Week",
    "timestamp": "2016-02-16T06:00:10Z"
}

This will return the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:log-1.0",
  ":id": "a45994d8-f742-11e5-b327-577c8d294329",
  "type": "Week",
  "timestamp": "2016-02-16T06:00:10Z",
  "data": [
    {
      "timestamp": "2016-02-15T00:00:00Z",
      "data": "13.565768668075485"
    },
    {
      "timestamp": "2016-02-16T00:00:00Z",
      "data": "14.121469907407407"
    },
    {
      "timestamp": "2016-02-17T00:00:00Z",
      "data": "14.371851851851853"
    },
    {
      "timestamp": "2016-02-18T00:00:00Z",
      "data": "14.555833333333334"
    },
    {
      "timestamp": "2016-02-19T00:00:00Z",
      "data": "14.691284722222223"
    },
    {
      "timestamp": "2016-02-20T00:00:00Z",
      "data": "14.37712962962963"
    },
    {
      "timestamp": "2016-02-21T00:00:00Z",
      "data": "14.671793981481482"
    }
  ]
}

Note: Since we assume that the week starts on Monday and the 2016-02-16 is Tuesday, then the data will be starting from Monday 2016-02-15 .

Add a new object

To add a new object, you need to post your new objects in the following way

POST <server>:<port>/services/<parent type>/<parent id>/<objet type>

with the following Body in JSON format

{
  ":type": <object :type>,
  <other JSON objects>
}

If successful, the API will create a new location and it will return a JSON with an object based on your Body.

If not specified, the location ID will be automatically created by the API.

Note: Some objects need to be present on Couchbase before you can add them with your API.

Example

Suppose that you want to add an Action on the configuration with ID 35e115b8-d3d8-11e5-a061-c7f2006444de, then we use the following command:

POST <server>:<port>/services/configuration/35e115b8-d3d8-11e5-a061-c7f2006444de/action

with the wished Action Body in JSON format

{
  ":type": "urn:seluxit:xml:bastard:action-1.0",
  "report": {
    "my_value_id": "c9b55ffc-014a-11e6-b22c-bf582c6cb431",
    "partner_id": "ca97fe52-014a-11e6-9a9a-1f54bf4f1f89"
  }
}

The API will create the new object and it will return its JSON. In this case:

{
  ":type": "urn:seluxit:xml:bastard:action-1.0",
  ":id": "996328b6-c844-4ccb-a838-b715955901c5",
  "report": {
    "my_value_id": "c9b55ffc-014a-11e6-b22c-bf582c6cb431",
    "partner_id": "ca97fe52-014a-11e6-9a9a-1f54bf4f1f89"
  }
}

Register a new user

Register a new user

To register a new user you need to

POST <server>:<port>/services/register

with the following JSON as body:

{
    ":type" : "urn:seluxit:xml:bastard:register-1.0",
    "username": <username>,
    "password": <password>
}

Another possible key is: ":id"

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:register-1.0"
  • :id : ID of the current Register
  • username: the username chosen by the user
  • password: the password chosen by the user

NOTE: The username needs to be a valid email, for example "user@domain.com".

Delete an object

To delete an object, use the following command.

DELETE <server>:<port>/services/<object type>/<object id>

The API will delete the selected object and it will return a JSON with the following data:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  ":id": [
    <object id>
  ],
  "message": "Deleted"
}

Example

Suppose that you want to delete the Action with ID 996328b6-c844-4ccb-a838-b715955901c5, then we use the following command:

DELETE <server>:<port>/services/action/996328b6-c844-4ccb-a838-b715955901c5

The API will delete the selected object and it will return the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  ":id": [
    996328b6-c844-4ccb-a838-b715955901c5
  ],
  "message": "Deleted"
}

Delete multiple objects

To delete more objects, use the following command.

DELETE <server>:<port>/services/<parent type>/<parent id>/<object type>

The API will delete all the selected object and it will return a JSON with the following data:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Cleared"
}

Example

Suppose that you want to delete all the Actions of the Configuration with ID 35e115b8-d3d8-11e5-a061-c7f2006444de. Then you use the following command:

DELETE <server>:<port>/services/configuration/35e115b8-d3d8-11e5-a061-c7f2006444de/action

The API will delete all the selected object and it will return a JSON with the following data:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Cleared"
}

Objects

Hierarchy of objects

location
 |
 +-- group
 +-- stream
 |  |
 |  +-- subscription
 +-- shape
 +-- user
 +-- network
      |
      +-- device
            |
            +-- status
            +-- service
            |       |
            |       +-- value
            |              |
            |              +-- log
            +-- configuration
                    |
                    +-- action
                    +-- calculation
                    +-- calendar
                    +-- partner
                    +-- timer
                    +-- statemachine

Location

A Location is…

Location structure

This is an example of a Location:

{
  ":type": "urn:seluxit:xml:bastard:location-1.0",
  ":id": "37dea70c-1782-44ad-87f1-911fc7555a37",
  "name": "Location1",
  "network": [list networks],
  "user": [list users],
  "shape": [list shapes],
  "stream": [list streams],
  "group": [list groups]
}
  • :type : type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:location-1.0".
  • :id : ID of the current Location.
  • name: name of the current Location.
  • network: Gateways that are installed under this Location.
  • user: an array with the Users that have access to this Location
  • shape:
  • stream:
  • group:

Retrieve a Location by ID

To retrieve a Location, you need to GET it in the following way

GET <server>:<port>/services/location/<location id>

Retrieve a list of the available Locations

To retrieve a list of the available Locations use the following command:

GET <server>:<port>/services/location

Add a new Location

POST <server>:<port>/services/location

with the chosen Body in JSON format.

Update a Location

To update a Location use the following command:

PUT <server>:<port>/services/location/<location id>

with the chosen Body in JSON format.

Delete a Location

To delete a Location use the following command:

DELETE <server>:<port>/services/location/<location id>

Delete all Locations

To delete all the Locations use the following command:

DELETE <server>:<port>/services/location/

Group

A group is…

Group structure

This is an example of a Group:

{
  ":type": "urn:seluxit:xml:bastard:group-1.0",
  ":id": "27c02958-3b34-45c6-a29c-a1d1286912c3",
  "name": "view1",
  "type": "view",
  "service": [
    {
      "serviceURI": "group/41d39ac1-d793-4596-a35d-f1a048fe81a1",
      "anchor": [0, 0],
      "data": ""
    },
    {
      "anchor": {
        "x": 199.55699114046638,
        "y": 418.46663594374866
      },
      "serviceURI": "service/567c0d54-107b-49ef-be77-c7347ecdf938",
      "data": ""
    }
  ]
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:group-1.0"
  • :id : ID of the current Group
  • name: name of the current Group
  • type: type of the current Group
  • service: it is composed by a "serviceURI" (uri), an "anchor" point (point) and some data.

Retrieve a Group by ID

To retrieve a Group, you need to GET it in the following way:

GET <server>:<port>/services/group/<group id>

Retrieve a list of Groups from a Location

To retrieve a list of Groups from a Location, use the following command:

GET <server>:<port>/services/location/<location id>/group

Add a new Group in one Location

To add a Group to one of your Location you need to post it in the following way:

POST <server>:<port>/services/location/<location id>/group

with the chosen Body in JSON format.

Update a Group

To update a Group to one of your Location you need to put it in the following way:

PUT <server>:<port>/services/group/<group id>

with the chosen Body in JSON format.

Delete a Group

To delete a Group use the following command:

DELETE <server>:<port>/services/group/<group id>

Delete all the Groups of a Location

To delete a Group of a Location use the following command:

DELETE <server>:<port>/services/location/<location id>/group

Stream

A Stream is…

Stream Structure

This is an example of a Stream:

{
  ":type": "urn:seluxit:xml:bastard:stream-1.0",
  ":id": "f96e1550-ce85-4dfb-a60b-41053cb48527",
  "subscription": [list subscriptions]
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:stream-1.0"
  • :id : ID of the current Stream
  • subscription: an array of the Subscriptions associated with the Stream

Retrieve a Stream by ID

To retrieve a Stream, you need to GET it in the following way:

GET <server>:<port>/services/stream/<stream id>

Retrieve a list of Streams from a Location

To retrieve a list of Streams from a Location, use the following command:

GET <server>:<port>/services/location/<location id>/stream

Subscription

A Subscription is…

Structure Subscription

This is an example of a Subscription:

{
  ":type": "urn:seluxit:xml:bastard:stream-1.0:subscription",
  ":id": "c317930a-49f3-480b-b736-ae09f992998f",
  "urn": "urn:seluxit:xml:bastard:network-1.0",
  "id": "607f07a0-7739-455b-962b-7669d6a7f085"
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:subscription-1.0"
  • :id : ID of the current Subscription
  • urn:
  • id:

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Subscription by ID

To retrieve a Subscription, you need to GET it in the following way:

GET <server>:<port>/services/subscription/<subscription id>

Retrieve a list of Subscriptions from a Stream

To retrieve a list of Subscriptions from a Stream, use the following command:

GET <server>:<port>/services/stream/<stream id>/subscription

Add a new Subscription in one Stream

To add a Subscription to one of your Stream you need to post it in the following way:

POST <server>:<port>/services/stream/<stream id>/subscription

with the chosen Body in JSON format.

Update a Subscription

To update a Subscription you need to put it in the following way:

PUT <server>:<port>/services/subscription/<subscription id>

with the chosen Body in JSON format.

Delete a Subscription

To delete a Subscription use the following command:

DELETE <server>:<port>/services/subscription/<subscription id>

Delete all the Subscriptions of a Stream

To delete a Subscription of a Stream use the following command:

DELETE <server>:<port>/services/stream/<stream id>/subscription

Shape

A Shape is used to manage the canvas in the front-end that shows the disposition of the rooms in a Location. Each Shape manages one room in our Location..

Structure Shape

This is an example of a Shape:

{
  ":type": "urn:seluxit:xml:bastard:shape-1.0",
  ":id": "0571aced-4522-4ff8-8ab3-6580c9d85158",
  "name": "Square shape",
  "name_anchor": {
    "x": 248.5,
    "y": 317.6
  },
  "type": "",
  "contour":
  [
    {
      "anchor": {
        "x": 130,
        "y": 220
      },
      "handle": [
        {
          "x": -12.5,
          "y": -21.69999999999999
        },
        {
          "x": -15.52234296528701,
          "y": -112.26865945028158
        }
      ]
    },
    {
      "anchor": {
        "x": 500,
        "y": 210
      },
      "handle": [
        {
          "x": -79.67386353289328,
          "y": 3.6053218973283947
        },
        {
          "x": 430.3243917451716,
          "y": -25.134931495204853
        }
      ]
    },
    ...
  ]
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:shape-1.0"
  • :id : ID of the current Shape
  • name: name of the current Shape
  • type: type of the current Shape
  • name_anchor: the position of the name of the device
  • contour: the list of the points that delimits the perimeter of the Shape
  • anchor: the position in the canvas of a point of the perimeter
  • handle: the used handle to manage a possible curve line on the perimeter of the Shape

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Shape by ID

To retrieve a Shape, you need to GET it in the following way:

GET <server>:<port>/services/shape/<shape id>

Retrieve a list of Shapes from a Location

To retrieve a list of Shapes from a Location, use the following command:

GET <server>:<port>/services/location/<location id>/shape

Add a new Shape to a Location

To add a Shape to one of your Location you need to post it in the following way:

POST <server>:<port>/services/location/<location id>/shape

Update an Action

To update a Shape you need to put it in the following way:

PUT <server>:<port>/services/shape/<shape id>

with the chosen Body in JSON format.

Delete a Shape

To delete a Shape use the following command:

DELETE <server>:<port>/services/shape/<shape id>

Delete all the Shapes of a Location

To delete all the Shapes of a Location use the following command:

DELETE <server>:<port>/services/location/<location id>/shape

User

 

Structure User

This is an example of a User:

{
  ":type": "urn:seluxit:xml:bastard:user-1.0",
  ":id": "69823cc7-2c7c-4c7c-85fd-5715586315fa",
  "username": "username@domain.com",
  "first_name": "Mark",
  "last_name": "Ren",
  "email": "markren@domain.com",
  "phone": "+452254658260030",
  "notification": true,
  "role": "Boss"
}
  • :type : type of the object that we are looking, in this case it is ""urn:seluxit:xml:bastard:user-1.0"".
  • :id : ID of the current User.
  • username: username of the retrieve User.
  • first_name: (optional) first name of the User
  • last_name: (optional) last name of the User
  • email: (optional) email of the User
  • phone: (optional) phone of the User
  • notification: (optional) boolean that indicates if the user wants notifications or not
  • role: (optional)

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a User

To retrieve a User, use the following command:

GET <server>:<port>/services/user/<user id>

Retrieve a list of the available Users

To retrieve a list of the Users use the following command:

GET <server>:<port>/services/user

The API will return a JSON with the following data:

{
  ":type": "urn:seluxit:xml:bastard:idlist-1.0",
  ":id": null,
  "id": [list users id],
  "@type": "urn:seluxit:xml:bastard:user-1.0"
}

Retrieve a list of the Users in one location

To retrieve a list of the Users use the following command:

GET <server>:<port>/services/location/<location id>/user

The API will return a JSON with the following data:

{
  ":type": "urn:seluxit:xml:bastard:idlist-1.0",
  ":id": <location id>,
  "id": [list users id],
  "@type": "urn:seluxit:xml:bastard:user-1.0"
}

Add a new User in one Location

To add a new User in one Location uses the following command:

POST <server>:<port>/services/location/<location id>/user

with the chosen Body in JSON format.

Update a User

To update a User you need to put it in the following way:

PUT <server>:<port>/services/location/<location id>/user

with the chosen Body in JSON format.

Delete a User

To delete a User use the following command:

DELETE <server>:<port>/services/user/<user id>

Delete all the Users

To delete all the Users use the following command:

DELETE <server>:<port>/services/user

Network

 

Structure Network

This is an example of a Network:

{
  ":type": "urn:seluxit:xml:bastard:network-1.0",
  ":id": "606f07a0-7739-455b-962b-7669d6a7f085",
  "name": "Network1",
  "device": [list devices]
}
  • :type : type of the object that we are looking, in this case it is urn:seluxit:xml:bastard:network-1.0".
  • :id : ID of the current Network.
  • name: name of the current Network.
  • device: an array with the list of the Devices installed on this Network.

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Network

To retrieve a Network, use the following command:

GET <server>:<port>/services/network/<network id>

Retrieve a list of Networks from a Location

To retrieve a list of Networks from a Location, use the following command:

GET <server>:<port>/services/location/<location id>/network

Add a Network in one Location

To add a Network you need to know the ID of the Location and of the gateway that you are going to use. Then you use the following command:

To add a Network in one Location you need to post it in the following way:

POST <server>:<port>/services/location/<location id>/network

with the chosen Body in JSON format. The Network needs to have already a Gateway installed on the database.

Update a Network

To update a Network use the following command:

POST <server>:<port>/services/network/<network id>

with the chosen Body in JSON format.

Delete a Network

To delete a Network use the following command:

DELETE <server>:<port>/services/network/<network id>

Device

 

Structure Device

This is an example of a Device:

{
  ":type": "urn:seluxit:xml:bastard:device-1.0",
  ":id": "2b412da8-9506-4fe6-ada7-c2625c3c95ef",
  "name": "DONGLE",
  "manufacturer": "Seluxit",
  "product": "1-Gateway",
  "version": "1-2.5.0-1.2.1-4668-1.0.2",
  "serial": "3034F8EE90155B4000000021",
  "protocol": "Lemonbeat",
  "communication": "Always Online",
  "included": "1",
  "status": [list statuses],
  "service": [list services],
  "configuration": [list configurations]
}

Another possible key is "description".

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:device-1.0"
  • :id : ID of the current Device
  • name: name of the current Device
  • manufacturer: name of the company that create the device.
  • product: type of the device
  • version: version of the used device
  • serial: serial of the device
  • protocol: communication protocol used by the device
  • communication: status of the communication of the device
  • include:
  • description: a description of this device
  • status: an array with the list of the statutes set up on the device
  • service: an array with the list of the services installed on the device
  • configuration: an array with the list of the configurations set up on the device

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Device

To retrieve a Device, use the following command:

GET <server>:<port>/services/device/<device id>

Retrieve a list of Devices from a Network

To retrieve a list of Actions from a Network, use the following command:

GET <server>:<port>/services/network/<network id>/device

Add a Device in one Network

To add a device use the following command:

POST <server>:<port>/services/network/<network id>/device

Note that if the Device does not really exist, the API will return an error message.

Update a Device

At the moment is not possible to update a Device.

Delete a Device

To delete a Device, use the following command:

DELETE <server>:<port>/services/device/<device id>

Delete all Devices

To delete all the Device from a Network, use the following command:

DELETE <server>:<port>/services/network/<network id>/device/

Status

A Status is used to report errors in the device.

Structure Status

This is an example of a Status:

{
  ":type": "urn:seluxit:xml:bastard:status-1.0",
  ":id": "35e8efd2-d3d2-11e5-b9ef-001a6500147c",
  "level": "error",
  "type": "application",
  "message": "STATUS_DEVICE_INCLUSION_FAILURE",
  "timestamp": "2016-02-15T10:52:30.574970Z"
}

Another possible key is "data".

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:status-1.0"
  • :id : ID of the current Status
  • level: the possible levels are "important", "error", "warning", "info" and "debug"
  • type: it contains the type of error. The possible types are "public key", "memory information", "device description", "value description", "value", "parter information", "action", "calculation", "timer", "calendar", "statemachine", "firmware update", "configuration", "exi", "system", "application" and "gateway"
  • message; a code that describe what happen
  • timestamp: it needs to be a dateTime
  • data: optimal data for the Status

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Status by ID

To retrieve a Status, you need to GET it in the following way:

GET <server>:<port>/services/status/<status id>

Retrieve a list of Statuses from a Device

To get a list of Statuses, use the following command:

GET <server>:<port>/services/device/<device id>/status

Add a new Status in one Device

The user cannot add Statuses on a Device. The Statuses will be created by the Device.

Update a Status

The user cannot modify Statuses on a Device. The Statuses will be modified by the Device.

Delete a Status

To delete a Status, you need to DELETE it in the following way

DELETE <server>:<port>/services/status/<status id>

Delete all Statuses

To delete all the Statuses of a device, you need to DELETE it in the following way

DELETE <server>:<port>/services/status/device/<device id>/status

Service

A Service is used to describe each possible Values for a specific device. A Service can assign some limit to the values: as min, max or steps.

Structure Service

This is an example of a Service:

{
  ":type": "urn:seluxit:xml:bastard:service-1.0",
  ":id": "0d365991-62d2-4ecd-a7b7-7e4b0eaffca6",
  "name": "soil_humidity",
  "permission": "r",
  "type": "Humidity",
  "number": {
    "min": "0.000000",
    "max": "100.000000",
    "step": "1.000000",
    "unit": "percent"
    },
  "status": "ok",
  "value": [list values]
}

This service check the humidity of the soil. It can be only read by the User and it will have percentage Values between 0% and 100% with one steps of 1%.

Other possibles keys are "virtual", "period", "delta", "set", "string", "blob" and "xml".

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:service-1.0"
  • :id : ID of the current Service
  • name: name of the current Service
  • permission: permissions of write and reading, it can be "r" (read only), "w" (write only), "rw" or "wr" (read and write)
  • type: indicate the type of the Service we are storing
  • number: contains some limitations of the data that we can receive in our device, as the minimum value, the maximum value, the steps-size between the values and the unit of the value. The unit is in the International System of Units (SI) format.
  • status: it can be "ok", "update" or "pending"
  • virtual: a boolean that specifies if the Value is Virtual or not
  • period:
  • delta:
  • set:
  • string: contains the max length og the string and the used encoding
  • blob: contains a max value and the used encoding
  • xml: contains the xsd file of the value, and possible namespaces.
  • value: an array of the Values connected with the Service

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Get a Service by ID

To get a Service, you need to GET it in the following way:

GET <server>:<port>/services/service/<service id>

Get a list of Services from a Device

To get a list of Services from a Device, use the following command:

GET <server>:<port>/services/device/<device id>/service

Delete a Service

To delete a list of Services, use the following command:

DELETE <server>:<port>/services/service/<service id>

Value

A Value indicate the value of a Service, for example the temperature of a room or the status ON/OFF of a device. A "Report" value will record the data from the environment where the device lives, a "Control" value will record the data in relation of the changes managed by an User.

A Value can have min, max and step in relation of its Service. If the Value is not included in the min-max range, then it is capped to be with in this range. If the Value do not conform the step size, then it is rounded down.

Structure Value

This is an example of a Value:

{
  ":type": "urn:seluxit:xml:bastard:value-1.0",
  ":id": "c2677811-cf12-47dd-81ea-4d3b71794556",
  "type": "Report",
  "timestamp": "2016-02-15T10:52:45.561090Z",
  "data": "5"
  "log": [list logs]
}

This means that a value of

Another possible key is "status".

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:value-1.0"
  • :id : ID of the current Value
  • type: it can be "Report" or "Control"
  • timestamp: it should be a dateTime. Denotes the time when we receive the last data from the Device
  • data: the data received from the device. A data can have min, max and step in relation of its Service. If the Value is not included in the min-max range, then it is capped to be with in this range. If the Value do not conform the step size, then it is rounded down.
  • status: it can be "Send", "Pending" or "Failed"
  • log: array of the Logs connected with the Value

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Value

To retrieve a Value, you need to GET it in the following way

GET <server>:<port>/services/value/<value id>

Retrieve a list of Values in one Service

To retrieve a list of Values from a Service, use the following command:

GET <server>:<port>/services/service/<service id>/value

Add a new Value in one Service

To add a Value to one of your Service you need to post it in the following way:

POST <server>:<port>/services/service/<service id>/value

Update a Value

To update a Value, you need to put it in the following way

PUT <server>:<port>/services/value/<value id>

Delete a Value

To delete a Value, you need to deleteit in the following way

DELETE <server>:<port>/services/value/<value id>

Delete all Values of a Session

To delete a Value of a Session use the following command:

DELETE <server>:<port>/services/service/<service id>/value

Log

 

Structure Log

This is an example of a Log:

{
  ":type": "urn:seluxit:xml:bastard:log-1.0",
  ":id": "ef4ace4c-14c6-46a1-82c8-07830576b9a9",
  "type": "Hour",
  "timestamp": "2016-02-25T15:04:26.295690Z"
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:log-1.0".
  • :id : ID of the current Log.
  • type: it can be "Hour", "Day", "Week", "Month", "Year" or "Raw"
  • timestamp: it should be a DateTime.

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Log by ID

To retrieve a Log, you need to GET it in the following way:

GET <server>:<port>/services/log/<log id>

Retrieve a list of Logs from a Configuration

To get a list of Logs, use the following command:

GET <server>:<port>/services/value/<value id>/log

Retrieve data from a Log – Update a Log

PUT <server>:<port>/services/log/<log id>

with in the Body what you want to retrieve and update. We send to information from logto obtain more information on the data received by the log.

Add a new Log in one Value

To add a new Log in one Value you need to post it in the following way:

POST <server>:<port>/services/value/<value id>/log

with the chosen Body in JSON format.

Delete a Log

To delete a Log ses:

DELETE <server>:<port>/services/log/<log id>

Delete all Logs of a Value

To delete all Logs from a Value uses:

DELETE <server>:<port>/services/value/<value id>/log

NOTE: Since a Value cannot have more than one Log, this command is equivalent to the previous one.

Configuration

A Configuration is…

Configuration structure

This is an example of a Configuration:

{
  ":type": "urn:seluxit:xml:bastard:configuration-1.0",
  ":id": "d9200c7c-d3ea-11e5-94df-001a65001500",
  "status": "active",
  "limits": {
    "partner": "5",
    "action": "30",
    "calendar": "20",
    "calculation": "30",
    "timer": "15",
    "statemachine": "10",
    "transactions": "40"
  },
  "partner": [list partners],
  "action": [list actions],
  "calendar": [list calendars],
  "calculation": [list calculations],
  "timer": [list timers],
  "statemachine": [list statemachines]
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:configuration-1.0"
  • :id : ID of the current Configuration
  • status: it can be "idle", "active", "failed", "commit" or "started"
  • limits: denotes how many Partners, Actions, Calendars, Calculations, Timers and Statemachines this Configuration can have
  • partner: an array of the Partners associated with the Configuration
  • action: an array of the Actions associated with the Configuration
  • calendar: an array of the Calendars associated with the Configuration
  • calculation: an array of the Calculations associated with the Configuration
  • timer: an array of the Timers associated with the Configuration
  • statemachine: an array of the Statemachines associated with the Configuration

Configuration status

To use a Configuration, it is necessary to understand its "status".

An active Configuration is a Configuration that it is in use on the Device. All the possible Actions that exists on the Device will be activated when an event is triggered (for example by a Calendar or by a Timer).

An idle Configuration is an available Configuration that can be activated on the Device. When you want to add (POST) a Configuration, the status of your Configuration must be "idle". Other statuses are not accepted when you POST a Configuration.

A commit Configuration is a Configuration that the User wants to change from status "idle" to status "active". To "commit" a configuration, the user must PUT a status "commit".

A failed Configuration is a Configuration that was refused by the Gateway after the user tried to "commit" it.

A started Configuration is a Configuration that was accepted by the Gateway and it is sent to the Device. Note that if this Configuration is refused by the Device the status will remain "started."

Example step 1: Retrieve the active Configuration of a Device

To find the active Configuration of a Device, use the command:

GET <server>:<port>/services/device/67a72ff2-2283-11e6-8ac4-5be0c7178df9/configuration

where "67a72ff2-2283-11e6-8ac4-5abe0c7178df9" is the ID of the Device. This will return the list of the Configurations for the Device. By watching the statuses of the Configuration, the user can retrieve the active Configuration.

This can be done with the command:

GET <server>:<port>/services/configuration/21b3c126-2284-11e6-ab65-df06282d1afc

where "21b3c126-2284-11e6-ab65-df06282d1afc" is ID of the active Configuration.

In this example the following active Configuration on the Device handles a Temperature set point with ID "ad29f8dd-d180-420c-ba23-c8b11b27a31b".

{
  ":type": "urn:seluxit:xml:bastard:configuration-1.0",
  ":id": "35e115b8-d3d8-11e5-a061-c7f2006444de",
  "status": "active",
  "limits": {
    "partner": "5",
    "action": "30",
    "calendar": "20",
    "calculation": "30",
    "timer": "15",
    "statemachine": "10",
    "transactions": "40"
  },
  "partner": [ ],
  "action": [{
    ":type": "urn:seluxit:xml:bastard:action-1.0",
    ":id": "7b9ab4b3-74bd-40f2-a747-ab43c185909d",
    "set": {
      "value_id": "ad29f8dd-d180-420c-ba23-c8b11b27a31b",
      "number": "16"
    }
  }],
  "calendar": [{
    ":type": "urn:seluxit:xml:bastard:calendar-1.0",
    ":id": "ad0ae265-6b03-4b96-839d-444ff5803473",
    "start": "2016-05-25T12:00:00.000Z",
    "action_id": "7b9ab4b3-74bd-40f2-a747-ab43c185909d"
  }],
  "calculation": [],
  "timer": [],
  "statemachine": []
}

In particular, from this Configuration we can understand that on 25th of May 2016 at 12.00 the Temperature set point will be set up to 16°C. By reading step-by-step from the Configuration, we can see that our Calendar will start the 25th of May 2016 at 12.00 and it will call the Action with ID "7b9ab4b3-74bd-40f2-a747-ab43c185909d". In turn, this Action will set up to 16°C a Value with ID "ad29f8dd-d180-420c-ba23-c8b11b27a31b" (our Temperature set point).

Example step 2: Create a New Configuration

Now we want to add a Calendar such that it will set up to 16°C also the 26th of May at 12.00. To do this we need to POST a new Configuration in the following way.

POST <server>:<port>/services/67a72ff2-2283-11e6-8ac4-5be0c7178df9/configuration

where "67a72ff2-2283-11e6-8ac4-5abe0c7178df9" is the ID of the Device. As body we can use the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:configuration-1.0",
  "status": "idle",
  "limits": {
    "partner": "5",
    "action": "30",
    "calendar": "20",
    "calculation": "30",
    "timer": "15",
    "statemachine": "10",
    "transactions": "40"
  },
  "partner": [ ],
  "action": [{
    ":type": "urn:seluxit:xml:bastard:action-1.0",
    ":id": "b01e91a4-2282-11e6-84b0-f3747d9da4af",
    "set": {
      "value_id": "ad29f8dd-d180-420c-ba23-c8b11b27a31b",
      "number": "16"
    }
  }],
  "calendar": [{
    ":type": "urn:seluxit:xml:bastard:calendar-1.0",
    ":id": "cabfed96-2282-11e6-8cac-736a4958d1c9",
    "start": "2016-05-25T12:00:00.000Z",
    "action_id": "b01e91a4-2282-11e6-84b0-f3747d9da4af"
  },{
    ":type": "urn:seluxit:xml:bastard:calendar-1.0",
    ":id": "a0683b8e-2282-11e6-977c-ffa0eeff0d44",
    "start": "2016-05-26T12:00:00.000Z",
    "action_id": "b01e91a4-2282-11e6-84b0-f3747d9da4af"
  }],
  "calculation": [],
  "timer": [],
  "statemachine": []
}

Note the following facts:

  • The new Configuration is very similar to the old Configuration with the addition of a Calendar.
  • By adding a new Configuration we are adding new Actions, Calendars, Calculations, Timers, Statemachines and Partners. For this reason we need to assign a new ID to this new Services.
  • The IDs used to refer other objects needs to refer to the correct object. For this reason the "action_id" of the Calendar is changed to the ID of the new Action "b01e91a4-2282-11e6-84b0-f3747d9da4af". But the "value_id" inside the "set" of the Action remains the same since we didn’t create any new Value.
  • We don’t need to insert the ":id" of the new Configuration since it will be generated automatically by the API.
  • The number of Actions (1) and Calendars (2) is smaller than the limits of 30 Actions and 20 Calendars.

Example step 3: Send the New Configuration to the Device

To commit this new Configuration to the Device, we need to change the status the Configuration to "commit" in the following way.

PUT <server>:<port>/services/configuration/de337754-2286-11e6-b8f2-8303f8d715c2

where "de337754-2286-11e6-b8f2-8303f8d715c2" is the ID of the new Configuration. As body we can use the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:configuration-1.0",
  "status": "commit"
}

After received this commit Configuration, the API will try to send the Configuration to the Gateway. If the Gateway accepts the new Configuration, it will change the status of the new Configuration in "started". If the Gateway refuses the new Configuration, it will change the status in "failed".

After received this started Configuration, the Gateway will try to send the Configuration to the Device. If the Device accepts the new Configuration, the status of the new Configuration will be changed in "active". At the same time the old active Configuration’s status will e changed in "idle".

Retrieve a Configuration by ID

To retrieve a Configuration, you need to GET it in the following way:

GET <server>:<port>/services/configuration/<configuration id>

Retrieve a list of Configurations from a Device

To retrieve a list of Configurations from a Device, use the following command:

GET <server>:<port>/services/device/<device id>/configuration

Add a new Configuration in one Device

To add a new Configuration use:

POST <server>:<port>/services/device/<device id>/configuration

with the data that you wish the Body. Remember to use "status": idle.

Update a Configuration

To update a Configuration use:

PUT <server>:<port>/services/configuration/<configuration id>

with the data that you wish the Body. Remember to use "status": commit.

Delete a Configuration

To delete a Configuration use:

DELETE <server>:<port>/services/configuration/<configuration id>

with the data that you wish the Body. Remember that you cannot delete a Configuration with its status "active".

Delete all Configurations

Since there is always an "active" Configuration, it is not possible to delete at once all the Configurations on a Device.

Action

An Action is used to get, set, report or invoke a Value on the Device itself or on an other Device. An Action can also start and stop a timer.

Structure Action

This is an example of an Action:

{
  ":type": "urn:seluxit:xml:bastard:action-1.0",
  ":id": "1b251112-9196-4892-b88c-dcebdf87db92",
  "report": {
    "my_value_id": "14ae70eb-3f92-4617-8963-b49d10635cba",
    "partner_id": "cb42279b-567e-45a5-9c03-95043e57804e"
  }
}

Other possible keys of Action are "get", "set", "invoke", "start_timer" and "stop_time".

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:action-1.0"
  • :id : ID of the current Action
  • get: this is an example:
  "get": {
    "value_id": "1e3cb6ad-c5d6-45b2-9b44-3839e19f3e85",
    "partner_id": "38637546-fa58-11e5-920f-efa5868a6010",
    "transport_mode": "0"
  }

It means that the Value ID 1e3cb6ad-c5d6-45b2-9b44-3839e19f3e85 should be retrieved from the Device with ID 38637546-fa58-11e5-920f-efa5868a6010. * value_id: (required) ID of the Value to retrieve * partner_id: ID of Device from where the Value should be retrieved. If not specified, the Value is from the Device itself * transport_mode: the transport mode the action should be send with (0: UDP, Fast and simple; 1: TCP, slow but more reliable)

  • set: this is an example:
  "set": {
    "value_id": "1e3cb6ad-c5d6-45b2-9b44-3839e19f3e85",
    "number": "20",
    "transport_mode": "0"
  }

It means that we will set to 20 the data of the Value with ID 1e3cb6ad-c5d6-45b2-9b44-3839e19f3e85. Other keys for set are "string", "hexBinary", "partner_id" and "calculation_id". * value_id: (required) ID of the Value to modify * partner_id: ID of Device from where the Value should be modified. If not specified, the Value is from the Device itself * transport_mode: the transport mode the action should be send with (0: UDP, Fast and simple; 1: TCP, slow but more reliable) * number / string / hexBinary / calculation_id: the value that we want to set in the Value.

  • report: this is an example:
  "report": {
    "my_value_id": "14ae70eb-3f92-4617-8963-b49d10635cba",
    "partner_id": "cb42279b-567e-45a5-9c03-95043e57804e"
  }

It means that we are sending a report to the Value with ID 14ae70eb-3f92-4617-8963-b49d10635cba, in the Device cb42279b-567e-45a5-9c03-95043e57804e. Another key is "transport_mode". * value_id: (required) ID of the Value used in the report * partner_id: ID of Device from where the Value should be reported. If not specified, the Value is from the Device itself * transport_mode: the transport mode the action should be send with (0: UDP, Fast and simple; 1: TCP, slow but more reliable)

  • invoke: this is an example:
  "invoke": {
    "my_value_id": "e5ba51e2-fa58-11e5-a4a7-cb4f6dba6e68",
    "partner_id": "fc2d2d32-fa58-11e5-b8bc-fbf9e3c674d6"
  }

 

  • start_timer: this is an example:
  "start_timer": {
    "timer_id": "93347ded-171f-4532-b399-d2b982c73b78"
  }

It means that we start the timer with id "timer_id". * timer_id: ID of the Timer.

  • stop_timer: this is an example:
  "stop_timer": {
    "timer_id": "51ea81de-fa59-11e5-bb0e-cb92e97521f1"
  }

It means that we stop the timer with id "timer_id". * timer_id: ID of the Timer.

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Action by ID

To retrieve a Action, you need to GET it in the following way:

GET <server>:<port>/services/action/<action id>

Retrieve a list of Actions from a Configuration

To retrieve a list of Actions from a Configuration, use the following command:

GET <server>:<port>/services/configuration/<configuration id>/action

Add a new Action in one Configuration

To add an Action to one of your Configuration you need to post it in the following way:

POST <server>:<port>/services/configuration/<configuration id>/action

with the chosen Body in JSON format.

It is possible to add a Action only if the Configuration where it lives has status "idle". To activate a new Action on the Device remember to "commit" the Configuration where the Action lives.

Update an Action

To update an Action you need to put it in the following way:

PUT <server>:<port>/services/action/<action id>

with the chosen Body in JSON format.

It is possible to update a Action only if the Configuration where it lives has status "idle". To activate an updated Action on the Device remember to "commit" the Configuration where the Action lives.

Delete a Action

To delete an Action use the following command:

DELETE <server>:<port>/services/action/<action id>

It is possible to delete a Action only if the Configuration where it lives has status "idle". To remove a deleted Action on the Device remember to "commit" the Configuration where the Action lives.

Delete all the Actions of a Configuration

To delete an Action of a Configuration use the following command:

DELETE <server>:<port>/services/configuration/<configuration id>/action

It is possible to delete Actions only if the Configuration where it lives has status "idle". To remove the deleted Actions on the Device remember to "commit" the Configuration where the Actions lives.

Calculation

A Calculation consists of one operator and two sides: left and right. Calculations can include other Calculations to generate complex operations. It will return a number or a boolean in relation of the used method.

Structure Calculation

This is an example of a Calculation:

{
  ":type": "urn:seluxit:xml:bastard:calculation-1.0",
  ":id": "b469060b-6fee-4a05-9d87-924b24ab7895",
  "left": {
    "value_id": "14ae70eb-3f92-4617-8963-b49d10635cba"
    },
  "right": {
      "constant_number": "25"
  },
  "method": "smaller"
}

This Calculation check if the value with ID 14ae70eb-3f92-4617-8963-b49d10635cba is smaller than 25.

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:calculation-1.0"
  • :id : ID of the current Calculation
  • method: the operation used in the calculation. Possible choices for the used method are "add", "subtract" "multiply", "divide", "modulo", "equal", "not_equal", "smaller", "greater", "smaller_or_equal", "greater_or_equal", "and" and "or".
  • left / right: a side can be a constant value, a reference to a value or another calculation.
  "left": {
    "value_id": "5b9fedbc-6bd1-499a-8e63-1d8b5c10eb8b",
    "is_updated": "true"
  }

Other possible value for left / right are: "partner_id" (with "value_id" and "is_updated"), "calculation_id", "statemachine_id", "timer_id", "calendar_id", "constant_number", "constant_string" and "constant_hxBinary"

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Calculation by ID

To retrieve a Calculation, you need to GET it in the following way:

GET <server>:<port>/services/calculation/<calculation id>

Retrieve a list of Calculations from a Configuration

To retrieve a list of Calculations from a Configuration, use the following command:

GET <server>:<port>/services/configuration/<configuration id>/calculation

Add a new Calculation in one Configuration

To add a Calculation to one of your Configuration you need to post it in the following way:

POST <server>:<port>/services/configuration/<configuration id>/calculation

with the chosen Body in JSON format.

It is possible to add a Calculation only if the Configuration where it lives has status "idle". To activate a new Calculation on the Device remember to "commit" the Configuration where the Calculation lives.

Update a Calculation

To update a Calculation to one of your Configuration you need to put it in the following way:

PUT <server>:<port>/services/calculation/<calculation id>

with the chosen Body in JSON format.

It is possible to update a Calculation only if the Configuration where it lives has status "idle". To activate an updated Calculation on the Device remember to "commit" the Configuration where the Calculation lives.

Delete a Calculation

To delete a Calculation use the following command:

DELETE <server>:<port>/services/calculation/<calculation id>

It is possible to delete a Calculation only if the Configuration where it lives has status "idle". To remove a deleted Calculation on the Device remember to "commit" the Configuration where the Calculation lives.

Delete all the Calculations of a Configuration

To delete all the Calculations of a Configuration use the following command:

DELETE <server>:<port>/services/configuration/<configuration id>/calculation

It is possible to delete Calculations only if the Configuration where it lives has status "idle". To remove the deleted Calculations on the Device remember to "commit" the Configuration where the Calculation lives.

Calendar

A Calendar is used to manage the time schedule of an Action. It says when to start and to end an Action and to repeat.

Structure Calendar

This is an example of a Calendar:

{
  ":type": "urn:seluxit:xml:bastard:calendar-1.0",
  ":id": "435e6e7d-beb6-499c-bfe7-2a71e8078193",
  "start": "2016-06-08T21:00:00.000Z",
  "action_id": "67aa3e03-8eac-45f0-aaa0-e770fd3e3f6a",
  "end": "2016-06-30T21:00:00.000Z",
  "repeat": "PT2H",
  "weekdays": {
    "monday": true,
    "tuesday": false,
    "wednesday": true,
    "thursday": true,
    "friday": false,
    "saturday": true,
    "sunday": false
  }
}

This means that the action with ID "435e6e7d-beb6-499c-bfe7-2a71e8078193" will have its first execution the 8th of June 2016 at 21:00 ("2016-06-08T21:00:00.000Z"). From that execution, it will repeat the same action every two hours ("PT2H") and it will end this timeschedule the 30th of June 2016 at 21.00 ("2016-06-30T21:00:00.000Z"). The command will not be executed on Tuesday, Friday and Sunday.

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:calendar-1.0"
  • :id : ID of the current Calendar
  • action_id: ID of the Action that we want to start
  • start: it should be a DateTime. It indicates when to start an Action
  • end: (optional) it should be a DateTime. It indicates when to end a scheduled repetition of an Action
  • repeat: (optional) indicates if the task shall be repeated. The time use ISO 8601 standard. By default it is setup on no repetitions.
  • weekdays: (optional) on which weekdays the task should be executed. By default all the days of the week are setup as true.

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Calendar by ID

To retrieve a Calendar, you need to GET it in the following way:

GET <server>:<port>/services/calendar/<calendar id>

Retrieve a list of Calendars from a Configuration

To retrieve a list of Calendars from a Configuration, use the following command:

GET <server>:<port>/services/location/<location id>/calendar

Add a new Calendar in one Configuration

To add a Calendar to one of your Configuration you need to POST it in the following way:

POST <server>:<port>/services/configuration/<configuration id>/calendar

with the body in JSON format.

It is possible to add a Calendar only if the Configuration where it lives has status "idle". To activate a new Calendar on the Device remember to "commit" the Configuration where the Calendar lives.

Update a Calendar

To update a Calendar you need to PUT it in the following way:

PUT <server>:<port>/services/calendar/<calendar id>

with the body in JSON format.

It is possible to update a Calendar only if the Configuration where it lives has status "idle". To activate an updated Calendar on the Device remember to "commit" the Configuration where the Calendar lives.

Delete a Calendar

To delete a Calendar uses:

DELETE <server>:<port>/services/calendar/<calendar id>

It is possible to delete a Calendar only if the Configuration where it lives has status "idle". To remove a deleted Calendar on the Device remember to "commit" the Configuration where the Calendar lives.

Delete all Calendars

To delete all the Calendars of a Configuration uses:

DELETE <server>:<port>/services/configuration/<configuration id>/calendar/

It is possible to delete Calendars only if the Configuration where it lives has status "idle". To remove the deleted Calendars on the Device remember to "commit" the Configuration where the Calendar lives.

Partner

A Partner is used to map an address to a simple ID to reference other devices by their address by only using an ID.

The partner service also support grouping multiple partners into a group with a id. If the device sends to a group, the message will be send to all the partners in the group.

Structure Partner

This is an example of a Partner:

{
  ":type": "urn:seluxit:xml:bastard:partner-1.0",
  ":id": "cb42279b-567e-45a5-9c03-95043e57804e",
  "device_id": "1cda3f63-90a6-40f2-9df0-05e979cfb3d1"
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:partner-1.0".
  • :id : ID of the current Partner.
  • device_id: ID of the Device partner of this Configuration

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Get a Partner by ID

To get a Partner, you need to GET it in the following way:

GET <server>:<port>/services/partner/<partner id>

Get a list of Partners

To get a list of Partners, use the following command:

GET <server>:<port>/services/configuration/<configuration id>/partner

Add a new Partner in one Configuration

To add a Partner to one of your Configuration you need to post it in the following way:

POST <server>:<port>/services/configuration/<configuration id>/partner

with the chosen Body in JSON format.

It is possible to add a Partner only if the Configuration where it lives has status "idle". To activate a new Partner on the Device remember to "commit" the Configuration where the Partner lives.

Update a Partner

To update a Partner to one of your Configuration you need to put it in the following way:

PUT <server>:<port>/services/partner/<partner id>

with the chosen Body in JSON format.

It is possible to update a Partner only if the Configuration where it lives has status "idle". To activate an updated Partner on the Device remember to "commit" the Configuration where the Partner lives.

Delete a Partner

To delete a Partner use the following command:

DELETE <server>:<port>/services/partner/<partner id>

It is possible to delete a Partner only if the Configuration where it lives has status "idle". To remove a deleted Partner on the Device remember to "commit" the Configuration where the Partner lives.

Delete all the Partners of a Configuration

To delete all the Partners of a Configuration use the following command:

DELETE <server>:<port>/services/configuration/<configuration id>/partner

It is possible to delete Partners only if the Configuration where it lives has status "idle". To remove the deleted Partners on the Device remember to "commit" the Configuration where the Partner lives.

Timer

A Timer will execute an Action with a delay.

Structure Timer

This is an example of a Timer:

{
  ":type": "urn:seluxit:xml:bastard:timer-1.0",
  ":id": "db068851-5403-44b3-8a88-bd81a128a18c",
  "after": "15000",
  "action_id": "a9096ba1-c6aa-4e7e-9b96-d851c0ab3051"
}

Another possible key is "calculation_id".

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:timer-1.0"
  • :id : ID of the current Timer
  • after: the delay in millisecond managed by the Timer
  • action_id: the Action ID of the Action that should be delayed
  • calculation_id: the timer will execute only if the Calculation is true

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Timer by ID

To get a Timer, you need to GET it in the following way:

GET <server>:<port>/services/timer/<timer id>

Retrieve a list of Timers from a Configuration

To get a list of Timers, use the following command:

GET <server>:<port>/services/configuration/<configuration id>/timer

Add a new Timer in one Configuration

To add a Timer to one of your Configuration you need to post it in the following way:

POST <server>:<port>/services/configuration/<configuration id>/timer

with the chosen Body in JSON format.

It is possible to add a Timer only if the Configuration where it lives has status "idle". To activate a new Timer on the Device remember to "commit" the Configuration where the Timer lives.

Update a Timer

To update a Timer to one of your Configuration you need to put it in the following way:

PUT <server>:<port>/services/timer/<timer id>

with the chosen Body in JSON format.

It is possible to update a Timer only if the Configuration where it lives has status "idle". To activate an updated Timer on the Device remember to "commit" the Configuration where the Timer lives.

Delete a Timer

To delete a Timer use the following command:

DELETE <server>:<port>/services/timer/<timer id>

It is possible to delete a Timer only if the Configuration where it lives has status "idle". To remove a deleted Timer on the Device remember to "commit" the Configuration where the Timer lives.

Delete all the Timers of a Configuration

To delete all the Timers of a Configuration use the following command:

DELETE <server>:<port>/services/configuration/<configuration id>/timer

It is possible to delete Timers only if the Configuration where it lives has status "idle". To remove the deleted Timers on the Device remember to "commit" the Configuration where the Timer lives.

Statemachine

A Statemachine is a collections of states and transactions. Each state of a Statemachine has its own ID so that it can be referenced. The StateMachine can be triggered by Timer events, Statemachine events, incoming value reports or local value updated.

Structure Statemachine

This is an example of a Statemachine:

{
  ":type": "urn:seluxit:xml:bastard:statemachine-1.0",
  ":id": "6ac112b9-b853-4ae5-bfb6-0106700038e4",
  "current_state": "2",
  "state": {
    "@id": "1",
    "transaction": {
      "action_id": "3dbdf2af-e431-4d12-a48e-30b29ce1f3e7",
      "goto_state": "2"
    }
  }
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:statemachine-1.0".
  • :id : ID of the current Statemachine.
  • current_state:
  • state:
    • @id: ID of the state
    • transaction:
      • action_id: Action ID that the state machine will execute when this transaction is executed
      • goto_state: State ID of the state machine will enter when this transaction is executed

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Statemachine by ID

To retrieve a Statemachine, you need to GET it in the following way:

GET <server>:<port>/services/statemachine/<statemachine id>

Retrieve a list of Statemachines from a Configuration

To retrieve a list of Statemachines from a Configuration, use the following command:

GET <server>:<port>/services/configuration/<configuration id>/statemachine

Add a new Statemachine in one Configuration

To add a Statemachine to one of your Configuration you need to post it in the following way:

POST <server>:<port>/services/configuration/<configuration id>/statemachine

with the chosen Body in JSON format.

It is possible to add a Statemachine only if the Configuration where it lives has status "idle". To activate a new Statemachine on the Device remember to "commit" the Configuration where the Statemachine lives.

Update a Statemachine

To update a Statemachine to one of your Configuration you need to put it in the following way:

PUT <server>:<port>/services/statemachine/<statemachine id>

with the chosen Body in JSON format.

It is possible to update a Statemachine only if the Configuration where it lives has status "idle". To activate an updated Statemachine on the Device remember to "commit" the Configuration where the Statemachine lives.

Delete a Statemachine

To delete a Statemachine use the following command:

DELETE <server>:<port>/services/statemachine/<statemachine id>

It is possible to delete a Statemachine only if the Configuration where it lives has status "idle". To remove a deleted Statemachine on the Device remember to "commit" the Configuration where the Statemachine lives.

Delete all the Statemachines of a Configuration

To delete all the Statemachines of a Configuration use the following command:

DELETE <server>:<port>/services/configuration/<configuration id>/statemachine

It is possible to delete Statemachines only if the Configuration where it lives has status "idle". To remove the deleted Statemachines on the Device remember to "commit" the Configuration where the Statemachine lives.

ACL

 

Structure ACL

This is an example of an ACL:

{
  ":type": "urn:seluxit:xml:bastard:acl-1.0",
  ":id": "41db8430-f7d6-11e5-bbbc-db43e5402d79",
  "owner": "d841c288-f801-11e5-830b-c3b1d7b0e410",
  "global": ["read": true, "write": false, "control": "true"]
  "user": [
    {
      "id": c4c23304-f802-11e5-9c77-4fdde030e910,
      "read": true
    },
    {
      "id": c4c23304-f802-11e5-9c77-4fdde030e910,
      "write": false
    }
  ]
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:action-1.0"
  • :id : ID of the current ACL
  • owner: ID of the owner of the ACL
  • global: to assign global permissions on reading, writing and controlling with "read", "write" and "control" respectively
  • user: to assign personal permissions on reading, writing and controlling with "read", "write" and "control" respectively

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve an ACL by Location ID

To retrieve an ACL use the following GET command:

GET <server>:<port>/services/acl/<location id>

Retrieve a list of ACL

To retrieve a list of ACL, use the following command:

GET <server>:<port>/services/location/

Note: ACLs and Locations have the same ID. If you try to retrieve directly a list of ACL with the command:

GET <server>:<port>/services/acl/

you will obtain the following error: ERROR 403 Can’t list ACL’s

Add a new ACL

To add a new ACL create a new Location with the command:

POST <server>:<port>/services/location

and the chosen Body in JSON format for your new Location.

Add a User to ACL – Update an ACL

To add a User to ACL use the following PUT command:

PUT <server>:<port>/services/acl/<location id>

with the chosen Body in JSON format.

Delete an ACL

To delete an ACL, you need to DELETE it in the following way

DELETE <server>:<port>/services/acl/<location id>

Gateway

 

Structure Gateway

This is an example of a Gateway:

{
  ":type": "urn:seluxit:xml:bastard:gateway-1.0",
  ":id": "606f07a0-7739-455b-962b-7669d6a7f085",
  "version": "1.1.9",
  "time_zone": " default (CET, +0100)",
  "vpn_ip": "10.142.0.22",
  "local_ip": "10.10.1.178",
  "wifinetwork": [list wifinetworks]
  "timezone": [list timezones]
}

Other possible keys are: "collector_endpoint", "uptime", "load", "memory", "feed", "auto_update" (boolean), "password", "network_key" and "antenna".

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:gateway-1.0"
  • :id : ID of the current Gateway
  • version: Version of the current Gateway
  • time_zone:
  • vpn_ip:
  • local_ip:
  • wifinetwork:
  • collector_endpoint:
  • uptime:
  • load:
  • memory:
  • feed:
  • auto_update:
  • password:
  • network_key:
  • antenna:
  • timezone:

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Gateway

To retrieve a Gateway, use the following command:

GET <server>:<port>/services/gateway/<gateway id>

Retrieve a list of Gateways from a Location

To retrieve a list of Gateways from a Location, use the following command:

GET <server>:<port>/services/location/<location id>/network

Note: Networks and Gateways have the same ID.

Add a new Gateway in one Location

To add a new Gateway create a new Network with the command:

POST <server>:<port>/services/location/<location id>/network

and the chosen Body in JSON format for your new Network.

Update a Gateway

To update a Gateway use the following command:

POST <server>:<port>/services/gateway/<gateway id>

with the chosen Body in JSON format.

Delete a Gateway

To delete a Gateway use the following command:

DELETE <server>:<port>/services/network/<network id>

Wifinetwork

 

Structure Wifinetwork

This is an example of Wifinetwork:

{
  ":type": "urn:seluxit:xml:bastard:wifinetwork-1.0",
  ":id": "b3a6c4e9-1345-4e00-91a0-1d41dc3dd671",
  "ssid": "MyWifiNetwork 4",
  "signal": "strong"
}

Another possible key is "encryption".

  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:wifinetwork-1.0".
  • :id : ID of the current Gateway.
  • ssid
  • signal
  • encryption

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Wifinetwork

To retrieve a Wifinetwork, use the following command:

GET <server>:<port>/services/wifinetwork/<wifinetwork id>

Retrieve a list of Wifinetworks

To retrieve a list of Wifinetwork, use the following command:

GET <server>:<port>/services/gateway/<gateway id>/wifinetwork

Add a new Wifinetworks

It is not possible to add a Wifinetworks. If you try you will obtain the following error: ERROR 501 No add method for backend

Update a Wifinetwork

To updae of Wifinetwork, use the following command:

PUT <server>:<port>/services/gateway/<gateway id>/wifinetwork

with the chosen Body in JSON format.

Delete one or more Wifinetworks

It is not possible to delete a Wifinetworks. If you try you will obtain the following error: ERROR 501 No delete method for backend

Timezone

 

Structure Timezone

This is an example of Timezone:

{
  ":type": "urn:seluxit:xml:bastard:timezone-1.0",
  ":id": "589a172a-06d3-4720-90af-0a3c70fab904",
  "name": "Africa/Abidjan"
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:wifinetwork-1.0".
  • :id : ID of the current Gateway.
  • name: indicate the timezone where the Gateway is situated

Header needed

To use the methods that follows you need these header:

  • Accept: application/json
  • Content-Type: application/json
  • X-Session: <session ID>

Retrieve a Timezone

To retrieve a Timezone, use the following command:

GET <server>:<port>/services/timezone/<timezone id>

Retrieve a list of Timezone

To retrieve a list of Timezone, use the following command:

GET <server>:<port>/services/gateway/<gateway id>/timezone

Add a new Timezone

It is not possible to add a Timezone. If you try you will obtain the following error: ERROR 501 No add method for backend

Update a Timezone

To update of Timezone, use the following command:

PUT <server>:<port>/services/gateway/<gateway id>/timezone

with the chosen Body in JSON format.

Delete one or more Timezones

It is not possible to delete a Timezone. If you try you will obtain the following error: ERROR 501 No delete method for backend

Session

Session structure

This is an example of a Session:

{
  ":type": "urn:seluxit:xml:bastard:session-1.0",
  ":id": "21330b79-d66a-40c6-888e-b466d2f4ac5a"
}
  • :type : the type of the object that we are looking, in this case it is "urn:seluxit:xml:bastard:session-1.0".
  • :id : ID of the current Session. This Session ID is what you need as X-Session in the header of the other methods.

start a new session – login

To start a new Session and receive your Session ID, you need to POST your username and password in the following way

POST <server>:<port>/services/session

with the following Body in JSON format:

{  
  ":type": "urn:seluxit:xml:bastard:session-1.0",  
  "username": <username>,  
  "password": <password>  
}

The API will return a JSON with the following data:

{  
  ":type": "urn:seluxit:xml:bastard:session-1.0",  
  ":id": <session id>,  
  "username": <username>,  
}

The obtain <session id> is a uuid that denote the Session ID that you need to use as X-Session header.

Get the data of a session

To get the data of the session use the following command

GET <server>:<port>/services/session/<session id>

Delete a session

To delete a session, you need to DELETE it in the following way

DELETE <server>:<port>/services/session/<session id>

Errors

The possible statuses that an user can receive are the following:
Code Response
200 OK
201 Created
202 Accepted
301 Moved Permanently
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable
408 Request Timeout
409 Conflict
415 Unsupported Media Type
500 Internal Server Error
501 Not implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
Each error (i.e. 4xx and 5xx statuses) can happen in different situations. In this section we analyze them.

Error 400 Gateway is already registered to you

By trying to install a new Gateway by using the same ID of an already registered Gateway on you, you will obtain a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Gateway is already registered to you"
}

Solution

The used Gateway is already registered on you thus you don’t need to add it again.

ERROR 400 Unsupported type

If you use a wrong :type, you will receive the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Unsupported type urn:seluxit:xml:bastard:<wrongtype>-1.0"
}

Solution

Remember to use the correct :type in relation of the object that you are trying to retrieve or modify.

ERROR 400 Invalid Email

If you use a username that it is not a valid email, you will receive the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Invalid Email"
}

Solution

Use a valid email like "user@domain.com".

ERROR 400 Invalid JSON

If you insert a wrong JSON, you will receive the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Invalid JSON"
}

Solution

Be careful with the creation of your JSON. The keys need to be between double quotes "". At the end of any line, but the last, you need to use a comma ",". Remember the semicolon ":" between keys and values.

ERROR 400 Password is missing

If you forget to insert a password on the login, you will receive the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message":  "Password is missing"
}

Solution

Insert a password when you are creating a new session.

ERROR 400 Username is missing

If you forget to insert a username at the login, you will receive the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message":  "Username is missing"
}

Solution

Insert a username when you are creating a new session.

ERROR 400 JSON must include type

When you use POST, PUT or PATCH, you need to insert the ":type" in the JSON of the Body. Although you will receive the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "JSON must include type"
}

Solution

Insert the ":type" of the object that you are updating.

ERROR 400 Can’t delete active configuration

If you delete a Configuration with an "active" status, you will receive the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Can't delete active configuration"
}

Solution

Check if the status of the Configuration is "active" or not. If you want to delete the Configuration, update the Configuration status in "idle", "commit", "failed" or "started".

ERROR 400 Configuration status can only be ‘idle’ when creating a new configuration

If you update a new Configuration with an "idle" status, you will receive the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Configuration status can only be 'idle' when creating a new configuration"
}

Solution

If you are updating a Configuration, change the Configuration status in "commit".

ERROR 400 Configuration status can only be ‘commit’ when changing the status

If you add new Configuration with a "commit" status, you will receive a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Configuration status can only be 'commit' when changing the status"
}

Solution

If you add a Configuration, change the Configuration status in "idle".

ERROR 400 ‘wrong event’ is not a valid service

If the insert address has a wrong service, you will obtain the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "'\<wrong event\>' is not a valid service"
}

Solution

Correct your address with a correct object.

ERROR 400 ‘wrong uuid’ is not a valid UUID

If the insert address has a wrong UUID, you will obtain the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "'<wrong uuid>' is not a valid UUID"
}

Solution

Correct your address with valid UUIDs.

ERROR 401 Unauthorized

By using a wrong username or password, you will obtain the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Unauthorized"
}

Solution

Check that your username and password are correct.

ERROR 401 X-session is not valid

By using a wrong X-Session, you will obtain the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "X-session is not valid"
}

Solution

Create a new session ID and remember to insert it in the X-Session of the header.

ERROR 403 Gateway is already registered

If you try to register on you a Gateway already registered on other people, you will obtain the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Gateway is already registered"
}

Solution

Before to register the Gateway on you, you should unregister the Gateway from the other people.

ERROR 403 Can’t list ACL’s

You cannot list ACL. If you try, you will obtain the following JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Can't list ACL's"
}

ERROR 404 Gateway not found

By trying to add a non existent gateway, you will obtain a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Not Found"
}

Solution

You are probably trying to install a non-existent Gateway. Check that the ID of the Gateway is the correct one and try again.

ERROR 404 Collection is empty

By trying to access an empty collection of objects, you will obtain a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Collection is empty"
}

ERROR 404 Not Found

By trying to use a method on a deleted or a non existent object, you will obtain a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Not Found"
}

Solution

Check that the insert address uses the correct IDs.

It is possible that some deleted elements are still visible when you try to get a collection of objects. This happen since Couchbase needs some time to update its database. Try to handle this mistake until Couchbase database is updated.

ERROR 405 is not allowed

If you try to use a not allowed method (GET, POST, PATCH, COPY, OPTIONS, LINK, …), you will receive a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "POST is not allowed"
}

ERROR 405 Method Not Allowed

If you try to use a not allowed method in the registration you will receive a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Method Not Allowed"
}

Solution

Sometimes it is possible that you are try to use a method on the wrong address. Check if you are using the correct one.

For example POST http://localhost:9292/services/location is a valid command, but POST http://localhost:9292/services/location/7c69cf54-f71c-11e5-8ccb-abd3630da0ed is not allowed.

ERROR 409 ID is already used

If you try to add an object with an already used ID, you will receive a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "ID 32e3dcf0-f71a-11e5-ac10-1fb6455aaa79 is already used"
}

Solution

Use a different ID in the ":id" in the Body of the object that you are creating.

ERROR 409 IDs do not match

If you PUT an updated object with an ID different from the one of the object that you are updating you will receive a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "ID's do not match"
}

Solution

Either you avoid to specify the ":id" in the Body or it needs to be the same of the ID’s object that you are updating.

ERROR 409 Username already registered

You cannot register the same user twice. If you try the user will return the following JSON.

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Username already registered"
}

Solution

Use a different username.

ERROR 500 Result contains unsuccessful operations

If you try to do invalid operations you will obtain a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Result contains unsuccessfull operations"
}

ERROR 500 ID not found in store

By using a non existent ID when adding a new device, you will obtain the following JSON: ~ { ":type": "urn:seluxit:xml:bastard:httpresponse-1.0", "message": "ID not found in store" } ~

Solution

Check that the device is correctly installed in the database.

ERROR 501 Replacing a complete collection is not supported

If you try to replace a collection with the method PUT, you will receive a similar JSON:

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "Replacing a complete collection is not supported"
}

Solution

Don’t use PUT when in the address you can get a collection of objects.

ERROR 501 No add method for backend

You cannot add this object.

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "No add method for backend"
}

ERROR 501 No delete method for backend

You cannot delete this object.

{
  ":type": "urn:seluxit:xml:bastard:httpresponse-1.0",
  "message": "No delete method for backend"
}