Get a snapshot image URI

Our example shows how to execute a Functional Item operation that gets a snapshot image URI from a camera attached to a gateway.
The gateway to camera communication follows the ONVIF protocol.

See Demos with a camera for the prerequisites.

The section is structured as follows:

Goal

To invoke a Functional Item operation that gets a snapshot image URI from a camera represented by a da:device:Cameras:4 device, you have to invoke a getImageURL operation of the device item da:item:Cameras:4:1:ImageProvider.

Below is an example of how this can be accomplished via the Bosch IoT Things API.

Request

Use the API docs of Bosch IoT Things

  • Authorize with a fresh Suite OAuth token.
    See Device provisioning > Authorize.

  • Message resource

    • POST /things/{thingId}/features/{featureId}/inbox/messages/{messageSubject}
      Send a message TO a specific feature of a specific thing

    • Set the thingId as follows: <your.namespace>:<your-gateway-id>:<your:device:id>
      In our example <your:device:id> maps to the Device Functional Item, i.e. the thingID must be: com.mycompany.example:gateway-001:da:device:Cameras:4

    • Set the featureId as follows: <ShortInterfaceName_index>
      In our example, the featureIdImageProvider_1 derives from the Device Item ID: da:item:Cameras:4:1:ImageProvider

    • Set the operation ID into the messageSubject field.
      In our example operation ID: getImageURL

    • Set the body
      The operation arguments are to be set in the request body:

      {
      "proxy":"false",
      "props":"null"
      }
    • Click Execute.

Response

Your response body should look similar to following snippet:

{
"result": "http://172.22.203.8/onvifsnapshot/media_service/snapshot?channel=1&subtype=0",
"error": null
}

Check the result

Open the URL in a web browser, from a PC in the same network as the camera. In case everything was successful, you should see the image created by the camera.