{"id":22052056,"url":"https://github.com/balena-io-examples/device-tags","last_synced_at":"2025-10-14T17:06:58.330Z","repository":{"id":42257990,"uuid":"118086345","full_name":"balena-io-examples/device-tags","owner":"balena-io-examples","description":"Examples on how to use the balena API \u0026 SDK to set device tags from within your app.","archived":false,"fork":false,"pushed_at":"2025-07-22T12:59:09.000Z","size":142,"stargazers_count":9,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T17:05:40.703Z","etag":null,"topics":["balena-sdk"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/balena-io-examples.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-01-19T06:27:17.000Z","updated_at":"2025-07-22T12:59:15.000Z","dependencies_parsed_at":"2024-10-25T17:59:52.788Z","dependency_job_id":"d8e644fa-8f4f-4a89-a3d6-e10f8ec3b360","html_url":"https://github.com/balena-io-examples/device-tags","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/balena-io-examples/device-tags","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balena-io-examples%2Fdevice-tags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balena-io-examples%2Fdevice-tags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balena-io-examples%2Fdevice-tags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balena-io-examples%2Fdevice-tags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/balena-io-examples","download_url":"https://codeload.github.com/balena-io-examples/device-tags/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balena-io-examples%2Fdevice-tags/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020085,"owners_count":26086805,"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-14T02:00:06.444Z","response_time":60,"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":["balena-sdk"],"created_at":"2024-11-30T15:12:59.517Z","updated_at":"2025-10-14T17:06:58.294Z","avatar_url":"https://github.com/balena-io-examples.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Using the balena API \u0026 SDK to set device tags from within apps.\n\nThis is a simple project which runs one container based on the [balena simple-server-node repository][simple-server-node] that demonstrates how to set device tags from within your application.\n\nThis project serves up `\"Hello World!\"` on port `:80` of your balena device and additionally:\n* Demonstrates how to use CURL to set tags (in the application's `start.sh`).\n  * sets the `device_tags_node.last_application_start` tag with the current timestamp when the application starts.\n* Demonstrates how to use the javascript [balena-SDK][balena-sdk] in the application's `device_tags_node/server.js`.\n  * sets the `device_tags_node.last_server_start` tag with the current timestamp whenever the node server starts.\n  * sets the `device_tags_node.last_request` tag with the current timestamp whenever the node server responds to an HTTP request.\n* Demonstrates how to use the python [balena-SDK][balena-sdk-python] in the application's `device_tags_python/src/app.py`. To try to python version, you need to uncomment the respective section in the docker-compose.yml.\n  * sets the `device_tags_python.last_server_start` tag with the current timestamp whenever the python server starts.\n  * sets the `device_tags_python.last_request` tag with the current timestamp whenever the python server responds to an HTTP request.\n\n### Setup\n\nCheck out the instructions in the [balena simple-server-node repository][simple-server-node] to get started.\n\n### Authentication\n\nThe scripts use the [`BALENA_API_KEY` environment variable][container-environment], which is injected to the environment of all balena applications, to authenticate all requests.\n\n[simple-server-node]:https://github.com/balena-io-projects/simple-server-node\n[balena-sdk]:https://github.com/balena-io/balena-sdk/\n[balena-sdk-python]:https://github.com/balena-io/balena-sdk-python/\n[container-environment]:https://docs.balena.io/runtime/runtime/#the-container-environment\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalena-io-examples%2Fdevice-tags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbalena-io-examples%2Fdevice-tags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalena-io-examples%2Fdevice-tags/lists"}