Remote access to Bosch IoT Manager
In this section you will learn how to programmatically access Bosch IoT Manager via its two provided entry points - through REST or through a Java client.
Remote access via REST
In order to access Bosch IoT Manager via REST, assign the REST endpoint URL to your REST client:
iot-manager.rest_endpoint: https://manager.eu-1.bosch-iot-suite.com/api/1/
You can also find it in the Binding credentials blade of your subscription in the Bosch IoT Suite UI.
Scroll down to "iot-manager" and copy the value of "rest_endpoint"
For further information on the available methods and required parameters refer to our REST API documentation.
Remote access via Java client
Set up Maven dependencies
Maven coordinates:
Configure your Maven to download the required artifacts from our repository.Refer to the following Bosch IoT Manager clients by pasting the following code snippets into your application's pom.xml:
Bosch IoT Manager :: Core :: gRPC Standalone Client
<dependency>
<groupId>com.bosch.iot.dm.libs</groupId>
<artifactId>dm.grpc.sa.client</artifactId>
<version>
1.1
.
38
</version>
</dependency>
Bosch IoT Manager :: Core :: gRPC Standalone Client Dependencies
<dependency>
<groupId>com.bosch.iot.dm.libs</groupId>
<artifactId>dm.grpc.sa.client.dependencies</artifactId>
<version>
1.1
.
38
</version>
<type>pom</type>
</dependency>
Bosch IoT Manager :: Core :: Client Library
<dependency>
<groupId>com.bosch.iot.dm.libs</groupId>
<artifactId>dm.core.client</artifactId>
<version>
1.1
.
38
</version>
</dependency>
Bosch IoT Manager :: Device Inventory :: Java Client
<dependency>
<groupId>com.bosch.iot.dm.di.libs</groupId>
<artifactId>dm.di.client</artifactId>
<version>
0.1
.
30
</version>
</dependency>
Bosch IoT Manager :: Mass Management Engine :: Mass Management Engine API
<dependency>
<groupId>com.bosch.iot.dm.mme.libs</groupId>
<artifactId>dm.mme.client</artifactId>
<version>
0.1
.
16
</version>
</dependency>
Bosch IoT Manager :: Mass Management Engine :: Mass Management Client Dependencies
<dependency>
<groupId>com.bosch.iot.dm.mme.libs</groupId>
<artifactId>dm.mme.client.dependencies</artifactId>
<version>
0.1
.
16
</version>
<type>pom</type>
</dependency>
Establish Connection
The connection between a Java Client and Bosch IoT Manager is established through the gRPC open source framework (find out more at https://grpc.io/).
This connection can be formed in two manners depending on the use case:
Single-user access
To successfully access Bosch IoT Manager remotely, create a Java client, which establishes the connection to the remote service. The following code snippet illustrates how to do this in the context of a single user:
/* Create a gRPC Service Factory that
could be used to get different remote services within the same user context */
GRPCServiceFactory grpcServiceFactory =
GRPCServiceFactory.newBuilder()
.host(
"grpc.manager.eu-1.bosch-iot-suite.com"
)
.ssl(
true
)
.port(
443
)
.credential(
new
Token(accessToken, refreshToken))
.build();
As a next step, use
DeviceInventory deviceInventory = grpcServiceFactory.service(DeviceInventory.
class
);
to invoke the remote service (DeviceInventory), i.e. the grpcServiceFactory you created in the previous step.
When attempting to connect to the Mass Management Engine replace DeviceInventory.class with MassManagementEngine.class.
Multiple-users access
When the use case requires multiple-user access, create the Java client which will be used to get the remote service, following the approach demonstrated in the code snippet below:
/* Create a gRPC Client that could be used to get remote services each with different user contexts*/
GRPCClient grpcClient = GRPCClient.getInstance(
/*ssl*/
true
,
/*host*/
"grpc.manager.eu-1.bosch-iot-suite.com"
,
/*port*/
443
);
To get the actual remote service:
DeviceInventory deviceInventory = grpcClient.service(DeviceInventory.
class
,
new
Token(accessToken, refreshToken));
Again, when attempting to connect to the Mass Management Engine replace DeviceInventory.class with MassManagementEngine.class.