{"id":23318417,"url":"https://github.com/cumulocity-iot/c8y-python-source-transformer-microservice","last_synced_at":"2026-07-17T11:31:45.135Z","repository":{"id":81494549,"uuid":"549400564","full_name":"Cumulocity-IoT/c8y-python-source-transformer-microservice","owner":"Cumulocity-IoT","description":"This project is an microservice that allows sending measurements, events and alarms to the Cumulocity API´s while not knowing the internalID.","archived":false,"fork":false,"pushed_at":"2022-10-26T11:10:06.000Z","size":164,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T05:17:15.948Z","etag":null,"topics":["cumulocity-iot","cumulocity-microservice","iot-analytics","microservice","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cumulocity-IoT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-11T06:07:02.000Z","updated_at":"2024-10-23T08:01:01.000Z","dependencies_parsed_at":"2023-05-25T00:00:27.800Z","dependency_job_id":null,"html_url":"https://github.com/Cumulocity-IoT/c8y-python-source-transformer-microservice","commit_stats":null,"previous_names":["cumulocity-iot/c8y-python-source-transformer-microservice"],"tags_count":1,"template":false,"template_full_name":"Cumulocity-IoT/cumulocity-iot-template","purl":"pkg:github/Cumulocity-IoT/c8y-python-source-transformer-microservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fc8y-python-source-transformer-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fc8y-python-source-transformer-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fc8y-python-source-transformer-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fc8y-python-source-transformer-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cumulocity-IoT","download_url":"https://codeload.github.com/Cumulocity-IoT/c8y-python-source-transformer-microservice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fc8y-python-source-transformer-microservice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280833471,"owners_count":26399077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cumulocity-iot","cumulocity-microservice","iot-analytics","microservice","python","python3"],"created_at":"2024-12-20T17:16:59.627Z","updated_at":"2025-10-24T17:17:26.988Z","avatar_url":"https://github.com/Cumulocity-IoT.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cumulocity-source-transformer-microservice\n\n\nThis project is an microservice that allows sending measurements, events and alarms to the Cumulocity API´s while not knowing the internalID. Therefore an own service endpoint is opened that requires the externalId and the externalId type in the POST request. The Event/Alarm/Measurement is thus transformed with the microservice and handed over to the real Cumulocity API.\n\n# Content\n- [cumulocity-source-transformer-microservice](#cumulocity-source-transformer-microservice)\n- [Content](#content)\n- [Quick Start](#quick-start)\n- [How to use](#how-to-use)\n- [Solution components](#solution-components)\n- [Installation from scratch](#installation-from-scratch)\n\n# Quick Start\nUse the provided zip here in the release and upload it as microservice.\n\n![Upload](/pics/upload.png)\n\n# How to use\n\nMeasurements, Alarms or Events can be send while adding \"type\" and \"externalId as parameter to the POST request.\nThe API endpoint is opened on /service/{service-name}/(event/events,alarm/alarms,measurement/measurements) and adds the interalId to the payload before handing the payload to the Cumulocity API.\nPlease be aware that due to that intermediate service no further inventory role filtering takes place anymore. A device that can reach that service endpoint can write to any device.\n\n```bash\ncurl --location \n--request POST '{C8Y_URL}/service/source-transformer/measurement/measurements?type=c8y_Serial\u0026externalId=mbay-test' \\\n--data-raw '{\n  \"time\": \"2022-10-12T12:03:27.845Z\",\n  \"type\": \"c8y_TemperatureMeasurement\",\n  \"c8y_Steam\": {\n    \"Temperature\": {\n      \"unit\": \"C\",\n      \"value\": 100\n    }\n  }\n}'\n```\n\n# Solution components\n\nThe microservice consists of 4 modules and a main runtime:\n* `main.py`: Main runtime that opens an health endpoint at /health and also creates the rest endpoints\n* `API/authentication.py`: Contains the Authentication class that requests the service user via the bootstrap user from within the microservice environment. See [documentation](https://cumulocity.com/guides/microservice-sdk/concept/#microservice-bootstrap) for more details.\n* `API/inventory.py`: Consists of the logic to deliver the internalId of the device from the externalId and the externalId type.\n* `API/measurments.py`: Creates the measurement from the payload and sends it to Cumulocity.\n* `API/events.py`: Creates the events from the payload and sends it to Cumulocity.\n* `API/alarms.py`: Creates the alarm from the payload and sends it to Cumulocity.\n\n* `resources/base.py`: Is the base class of the request within the service microservice. It contains the main logic on extracting the externalId and the externalId type from the POST request. It also queries the internalId while calling `API/inventory.py` and replaces the {\"source\": {\"id\": \"internalID\"} } within the json body of the POST request. The base class is used from the specialized classes that handles logic of the endpoints etc.\n* `resources/alarms.py`: Is called when the alarms endpoint is calles on the service microservices and hand the payload over to 'API/alarms.py'.\n* `resources/events.py`: Is called when the events endpoint is calles on the service microservices and hand the payload over to 'API/events.py'.\n* `resources/measurements.py`: Is called when the measurements endpoint is calles on the service microservices and hand the payload over to 'API/measurements.py'.\n\nDebug Level is set to be INFO and can be changed in `main.py`.\n\n# Installation from scratch\n\nTo build the microservice run:\n```\ndocker buildx build --platform linux/amd64 -t {NAMEOFSERVICE} .\ndocker save {NAMEOFSERVICE} \u003e image.tar\nzip {NAMEOFSERVICE} cumulocity.json image.tar\n```\n\nYou can upload the microservice via the UI or via [go-c8y-cli](https://github.com/reubenmiller/go-c8y-cli)\n\n\n------------------------------\n\nThese tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.\n_____________________\nFor more information you can Ask a Question in the [TECHcommunity Forums](https://tech.forums.softwareag.com/tags/c/forum/1/Cumulocity-IoT).\n\nYou can find additional information in the [Software AG TECHcommunity](https://tech.forums.softwareag.com/tag/Cumulocity-IoT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcumulocity-iot%2Fc8y-python-source-transformer-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcumulocity-iot%2Fc8y-python-source-transformer-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcumulocity-iot%2Fc8y-python-source-transformer-microservice/lists"}