Skip to content

Cumulocity IoT - Microservice example developed using Python and Docker

License

Notifications You must be signed in to change notification settings

manasesjesus/c8y_microservice-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello World of Cumulocity IoT Microservices

Cumulocity IoT microservice example developed using Python and Docker.

Prerequisites

  • Local Docker installation
  • An account on cumulocity.com. Create a free trial to test this example.

Build

Execute the following commands to build the Docker image and save it as image.tar:

$ docker build -t python-microservice .
$ docker save python-microservice > "image.tar"

Then pack image.tar together with the manifest cumulocity.json into a ZIP file.

$ zip python-microservice cumulocity.json image.tar

The resulting python-microservice.zip file contains the microservice and it is ready to be uploaded to the Cumulocity IoT platform.

Deployment

Deploy the microservice application (refer to Adding own applications in the Cumulocity IoT's User guide) and subscribe it afterwards.

It may take some minutes for the ZIP file to be uploaded. Once completed, the three endpoints of the microservice application can be tested.

Execution

Use a web browser or a terminal command (e.g. cURL) to make a GET request to the microservice endpoints providing your user credentials.

GET /service/python-microservice/environment
Host: <TENANT_DOMAIN>
Authorization: <AUTHORIZATION>

About

Cumulocity IoT - Microservice example developed using Python and Docker

Topics

Resources

License

Stars

Watchers

Forks