Cumulocity API Services

Author John Carter, Date March 2020, version 1.0,

Android v28 Kotlin developed library (.aar) giving access to Cumulocity via its REST API. Use this library when developing Android apps to access your back-end Cumlocity tenant.

Refer to this Cumulocity Developer Reference Site for more information on the underlying API implementation.

Access the different Cumulocity assets using the service classes defined in the package com.softwareag.jc.cumulocity.services.api and interrogate the results via objects defined by classes in the com.softwareag.jc.cumulocity.services.models package.

e.g.

    CumulocityConnectionFactory.connection(<tenant>, <instance e.g. cumulocity.com>).connect(<user>, <password>) { connection, responseInfo ->

       ManagedObjectsService(connection).managedObjectsForType(0, "c8y_DeviceGroup") { results ->

           val status: Int = results.status

           val failureReason: String? = if (status == 500)
               results.reason
           else
               null

           val objects: List<ManagedObject> = results.content
       }
   }

Connections can be reused, but services should not be reused and are not thread-safe, hence should not be used in parallel by different threads.

Assets Types

Classes exist for all major assets types; ManagedObject, Alarm, Binary, DataPoints, Event, Measurement, Operation and User

API Services

To retrieve these assets use one of the api service classes in the api package such as ManagedObjectsService, ManagedObjectService, AlarmsService, EventsService, MeasurementsService etc.

Packages

com.softwareag.jc.cumulocity.apiservices

com.softwareag.jc.cumulocity.services.api

Query/update Cumulocity assets via well defined classes

com.softwareag.jc.cumulocity.services.models

Classes defining the model for all of the cumulocity asset types.

com.softwareag.jc.cumulocity.services.models.extension

Represents a custom structure added to your Cumulocity Managed Object instances

Index

All Types