Skip to content

Adds a new Sensor

Request

Security
BearerToken
Bodyapplication/json
entityTypestring
Value:"sensor"
Example:"sensor"
idstring

Uniquely identifies this entity. A URI can be assigned by the client to indicate where more information can be retrieved. Note that every entity always has a unique EntityId. However since, OTM5.2 it is not required to send it in the request. One can be generated for you by the server.

Example:"6666f00c-1332-472c-aff9-bc11b3d53296"
namestring

Name of the entity. For display purposes and search only.

Example:"Temperature sensor in trailer x"
creationDatestring, (date-time)

The creation date of this entity.

lastModifiedstring, (date-time)

The last modified date of this entity. If none is given the creation date is used instead.

contextEventsArray of any(event)

The context events provides some optional information about the events that can provide additional information on the current state of this entity.

For example: your system might send ETA information for the arrival of a vehicle on a location. To make it clear what caused this ETA to be updated, we can include some information about what caused this ETA update by including an event as context. If your ETA update was caused by a location update, this event can be included as context. If the ETA was caused by a traffic accident on the route of the vehicle, you can include that event in the context.

externalAttributesobject
externalIdentifiersArray of objects(externalIdentifiers)

Standardized identifiers of this entity as known in external systems. Use this to exchange repeatable partner or system specific identifiers without overloading externalAttributes.

Example:
[ { "id": "AAA", "scheme": "CAS" } ]
placementstring

Sometimes more than one sensor can be associated with a single entity. This is the case e.g. in cooled trailers that are divided into compartments with different temperatures, where each compartment has its own sensor. The placement member can be used to identify where a sensor is placed. Parties using OpenTripModel to exchange sensor data may wish to agree on a standardized naming, but this is too specific to describe in the standard.

Example:"Compartment 1"
sensorTypestring

The type of sensor.

Example:"accelerometer"
actorsArray of any

The actors associated with this sensor, for instance the owners, the producers or the users of this sensor.

Example:
[ { "entity": { … }, "associationType": "inline" } ]
constraintany
curl -i -X PUT \
  https://otm-api-spec.redocly.app/_mock/api/5.9/otm/api/v5/sensors \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "6666f00c-1332-472c-aff9-bc11b3d53296",
    "name": "Temperature sensor in trailer x",
    "placement": "Compartment 1",
    "sensorType": "accelerometer",
    "actors": [
      {
        "entity": {
          "id": "45db6ed0-28a7-4e4a-baba-3d5f8d171103",
          "name": "Logistics manager",
          "contactDetails": [
            {
              "value": "Simon Isaac",
              "remark": "Wants to be called '\''Sim'\''.",
              "type": "firstName"
            },
            {
              "value": "Macan",
              "type": "lastName"
            },
            {
              "value": "+312012345678",
              "remark": "private cellphone of the CEO",
              "language": "nld",
              "type": "phone"
            },
            {
              "value": "simon@macan",
              "type": "email"
            },
            {
              "value": "NL74BANK5890469479",
              "type": "iban"
            },
            {
              "value": "NL000099998B57",
              "type": "vatCode"
            }
          ]
        },
        "associationType": "inline"
      }
    ]
  }'

Responses

The same entity

Bodyapplication/json
entityTypestring
Value:"sensor"
Example:"sensor"
idstring

Uniquely identifies this entity. A URI can be assigned by the client to indicate where more information can be retrieved. Note that every entity always has a unique EntityId. However since, OTM5.2 it is not required to send it in the request. One can be generated for you by the server.

Example:"6666f00c-1332-472c-aff9-bc11b3d53296"
namestring

Name of the entity. For display purposes and search only.

Example:"Temperature sensor in trailer x"
creationDatestring, (date-time)

The creation date of this entity.

lastModifiedstring, (date-time)

The last modified date of this entity. If none is given the creation date is used instead.

contextEventsArray of any(event)

The context events provides some optional information about the events that can provide additional information on the current state of this entity.

For example: your system might send ETA information for the arrival of a vehicle on a location. To make it clear what caused this ETA to be updated, we can include some information about what caused this ETA update by including an event as context. If your ETA update was caused by a location update, this event can be included as context. If the ETA was caused by a traffic accident on the route of the vehicle, you can include that event in the context.

externalAttributesobject
externalIdentifiersArray of objects(externalIdentifiers)

Standardized identifiers of this entity as known in external systems. Use this to exchange repeatable partner or system specific identifiers without overloading externalAttributes.

Example:
[ { "id": "AAA", "scheme": "CAS" } ]
placementstring

Sometimes more than one sensor can be associated with a single entity. This is the case e.g. in cooled trailers that are divided into compartments with different temperatures, where each compartment has its own sensor. The placement member can be used to identify where a sensor is placed. Parties using OpenTripModel to exchange sensor data may wish to agree on a standardized naming, but this is too specific to describe in the standard.

Example:"Compartment 1"
sensorTypestring

The type of sensor.

Example:"accelerometer"
actorsArray of any

The actors associated with this sensor, for instance the owners, the producers or the users of this sensor.

Example:
[ { "entity": { … }, "associationType": "inline" } ]
constraintany
Response
{ "id": "6666f00c-1332-472c-aff9-bc11b3d53296", "name": "Temperature sensor in trailer x", "placement": "Compartment 1", "sensorType": "accelerometer", "actors": [ { … } ] }