{"id":24221638,"url":"https://github.com/michdo93/openhab_postman_templates","last_synced_at":"2026-06-07T17:32:38.853Z","repository":{"id":135032057,"uuid":"527685048","full_name":"Michdo93/openhab_postman_templates","owner":"Michdo93","description":"Postman Collections Templates for openHAB and openHAB Cloud for accessing the REST API.","archived":false,"fork":false,"pushed_at":"2022-09-08T11:35:35.000Z","size":785,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T06:20:08.212Z","etag":null,"topics":["openhab","openhab2","openhab3","postman","postman-collection","postman-collections","rest","rest-api","restful-api"],"latest_commit_sha":null,"homepage":"","language":null,"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/Michdo93.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2022-08-22T18:24:35.000Z","updated_at":"2022-09-23T13:02:18.000Z","dependencies_parsed_at":"2023-05-11T09:45:09.002Z","dependency_job_id":null,"html_url":"https://github.com/Michdo93/openhab_postman_templates","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Michdo93%2Fopenhab_postman_templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Michdo93%2Fopenhab_postman_templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Michdo93%2Fopenhab_postman_templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Michdo93%2Fopenhab_postman_templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Michdo93","download_url":"https://codeload.github.com/Michdo93/openhab_postman_templates/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241763748,"owners_count":20016162,"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","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":["openhab","openhab2","openhab3","postman","postman-collection","postman-collections","rest","rest-api","restful-api"],"created_at":"2025-01-14T06:19:59.892Z","updated_at":"2025-03-04T00:45:46.155Z","avatar_url":"https://github.com/Michdo93.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# openhab_postman_templates\nPostman Collections Templates for openHAB and openHAB Cloud for accessing the REST API.\n\nPostman is an API platform for developers to design, build, test and iterate their APIs. As of April 2022, Postman reports having more than 20 million registered users and 75,000 open APIs, which it says constitutes the world's largest public API hub. The company is headquartered in San Francisco and maintains an office in Bangalore, where it was founded.\n\nPostman can be used with Mac, Windows, \u0026 Linux. You can download it [here](https://www.postman.com/downloads/).\n\n## Usage\n\n### Local openHAB Instance\n\n#### HTTP\n\nIf you want to connect to openHAB locally and with the `http` protocol you have to import `openhab-http.json`. Before importing please make sure that you change `\u003cusername\u003e` to the username of your openHAB user. Also you have to change `\u003cpassword\u003e` to the password of your openHAB user. Of course you must also change `\u003cyour-ip\u003e` to the ip address on which your openHAB instance is running. And at least you have to change `XXX` and `YYY`. This are parts of your ip address `192.168.XXX.YYY`.\n\nIt is recommended to use a text editor with a replace all function.\n\nFor testing you can install the [openhab_static_examples](https://github.com/Michdo93/openhab_static_examples). For this you can import `openhab-static-examples-http.json`. You have to make the same changes as described above.\n\n#### HTTPS\n\nIf you want to connect to openHAB locally and with the `https` protocol you have to import `openhab-https.json`. Before importing please make sure that you change `\u003cusername\u003e` to the username of your openHAB user. Also you have to change `\u003cpassword\u003e` to the password of your openHAB user. Of course you must also change `\u003cyour-ip\u003e` to the ip address on which your openHAB instance is running. And at least you have to change `XXX` and `YYY`. This are parts of your ip address `192.168.XXX.YYY`.\n\nIt is recommended to use a text editor with a replace all function.\n\nFor testing you can install the [openhab_static_examples](https://github.com/Michdo93/openhab_static_examples). For this you can import `openhab-static-examples-https.json`. You have to make the same changes as described above.\n\n### openHAB Cloud (as example myopenhab.org)\n\nIf you want to connect to openHAB remotely and use [myopenhab.org](https://myopenhab.org) you have to import `myopenhab.org.json`. Before importing please make sure that you change `\u003ce-mail\u003e` to the email address of your myopenhab.org user. Also you have to change `\u003cpassword\u003e` to the password of your myopenhab.org user.\n\nIt is recommended to use a text editor with a replace all function.\n\nFor testing you can install the [openhab_static_examples](https://github.com/Michdo93/openhab_static_examples). For this you can import `myopenhab.org-static-examples.json`. You have to make the same changes as described above.\n\n## Additional notes\n\n### Notes on HTTP request methods\n\nAs you can see with `openhab-static-examples-http.json`, `openhab-static-examples-https.json` or `myopenhab.org-static-examples.json` by testing the [openhab_static_examples](https://github.com/Michdo93/openhab_static_examples), you have to use `GET` to get the current `state` of an item, `PUT` for `postUpdate` an item and `POST` for `sendCommand` to an item.\n\n| HTTP request method        | Description  | Method | URL  |\n| :-------------: |:-------------:| :-----:| :-----:|\n| `GET`  | Retrieve the state of an item. | `n/a` | `https://\u003cbase_url\u003e/rest/items/{itemName}/state` |\n| `PUT`  | The state of an item is updated. | `postUpdate` | `https://\u003cbase_url\u003e/rest/items/{itemName}/state` |\n| `POST` | A command is sent to an item via a channel. | `sendCommand` | `https://\u003cbase_url\u003e/rest/items/{itemName}` |\n\nThe `\u003cbase_url\u003e` could be the ip address plus port of your local openHAB instance (`\u003cip_address\u003e:\u003cport\u003e`) or `myopenhab.org`. Of course if you are using `http` on your local instance you have to replace `https` with `http`.\n\n### Notes on Event Bus Item Events\n\nOf course you can try also to check the event of your item. Read more about it [here](https://www.openhab.org/docs/developer/utils/events.html#item-events). Sadly it will fail because [SSE](https://en.wikipedia.org/wiki/Server-sent_events) is not supported.\n \n| HTTP request method |  Event | \tDescription | \tURL | \n| :-------------: |:-------------:| :-----:| :-----:|\n| `GET`  | ItemAddedEvent |\tAn item has been added to the item registry. |\thttps://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/added |\n| `GET`  | ItemRemovedEvent |\tAn item has been removed from the item registry. |\thttps://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/removed |\n| `GET`  | ItemUpdatedEvent |\tAn item has been updated in the item registry. |\thttps://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/updated |\n| `GET`  | ItemCommandEvent |\tA command is sent to an item via a channel. |\thttps://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/command |\n| `GET`  | ItemStateEvent |\tThe state of an item is updated. |\thttps://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/state |\n| `GET`  | ItemStatePredictedEvent |\tThe state of an item predicted to be updated. |\thttps://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/statepredicted |\n| `GET`  | ItemStateChangedEvent |\tThe state of an item has changed. |\thttps://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/statechanged |\n| `GET`  | GroupItemStateChangedEvent |\tThe state of a group item has changed through a member. |\thttps://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/{memberName}/statechanged |\n\nThe `\u003cbase_url\u003e` could be the ip address plus port of your local openHAB instance (`\u003cip_address\u003e:\u003cport\u003e`) or `myopenhab.org`. Of course if you are using `http` on your local instance you have to replace `https` with `http`.\n\nAs an alternative to Postman, you can then use curl for this:\n\n|  Event | \tDescription | \tURL | \n|:-------------:| :-----:| :-----:|\n| ItemAddedEvent |\tAn item has been added to the item registry. |\tcurl \"https://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/added\" |\n| ItemRemovedEvent |\tAn item has been removed from the item registry. | curl\t\"https://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/removed\" |\n| ItemUpdatedEvent |\tAn item has been updated in the item registry. |\tcurl \"https://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/updated\" |\n| ItemCommandEvent |\tA command is sent to an item via a channel. |\tcurl \"https://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/command\" |\n| ItemStateEvent |\tThe state of an item is updated. |\tcurl \"https://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/state\" |\n| ItemStatePredictedEvent |\tThe state of an item predicted to be updated. |\tcurl \"https://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/statepredicted\" |\n| ItemStateChangedEvent |\tThe state of an item has changed. |\tcurl \"https://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/statechanged\" |\n| GroupItemStateChangedEvent |\tThe state of a group item has changed through a member. |\tcurl \"https://\u003cbase_url\u003e/rest/events?topics=openhab/items/{itemName}/{memberName}/statechanged\" |\n\n### Notes on Creating a new Item via the REST API\n\nYou can create a new Item like described in the following:\n\n| HTTP request method |  Event | \tDescription | \tURL | \n| :-------------: |:-------------:| :-----:| :-----:|\n| `PUT`  | Create a new item |\tCreating a new item and add it to the item registry. |\t`https://\u003cbase_url\u003e/rest/items/{itemName}` |\n\nIn the `body` you have to use `JSON`. An equvialent command with `curl` looks like in the following:\n\n```\ncurl -0 -v -X PUT http://\u003cbase_url\u003e/rest/items/{itemName} -H \"Content-Type: text/plain\" -H 'Accept: text/plain' --data-binary @- \u003c\u003c EOF\n{\n    \"type\": \"String\"\n    \"name\": \"myTestString\",\n    \"label\": \"my test string\"\n}\nEOF\n```\n\nIn `Postman` you have to make sure to selecht `raw` and `JSON` inside the `Body` tag. There you can add:\n\n```\n{\"type\": \"String\", \"name\": \"myTestString\", \"label\": \"my test string\"}\n```\n\nThe value will be `NULL`. If you want to add a value you can do something like in the following:\n\n```\n{\"type\": \"String\", \"name\": \"myTestString\", \"label\": \"my test string\", \"value\": \"Hello World\"}\n```\n\nIf you want to add your item to a `Group` you have to do something like in the following:\n\n```\n{\"type\": \"String\", \"name\": \"myTestString\", \"label\": \"my test string\", \"value\": \"Hello World\", \"groupNames\": [\"yourGroup\"]}\n```\n\nIf the `Group` to which you want to add the `Item` does not exist, you must first create this group:\n\n```\n{\"type\": \"Group\", \"name\": \"yourGroup\", \"label\": \"my new own group\"}\n```\n\nIf you want this `Group` to be subordinate to another `Group`, you can do the following:\n\n\n```\n{\"type\": \"Group\", \"name\": \"yourGroup\", \"label\": \"my new own group\", \"groupNames\": [\"parentGroup\"]}\n```\n\nIf this `Group` does not exist either, you can create this `Group` as described above.\n\nYou can also add an `Item` to multiple `Groups`. To do this, you need to do the following:\n\n```\n{\"type\": \"String\", \"name\": \"myTestString\", \"label\": \"my test string\", \"value\": \"Hello World\", \"groupNames\": [\"firstGroup\",\"secondGroup\",\"thirdGroup\"]}\n```\n\n\n### Notes on Deleting an Item via the REST API\n\nYou can delete an Item like described in the following:\n\n| HTTP request method |  Event | \tDescription | \tURL | \n| :-------------: |:-------------:| :-----:| :-----:|\n| `DELETE`  | Delete an item |\tDeleting an item and remove it from the item registry. |\t`https://\u003cbase_url\u003e/rest/items/{itemName}` |\n\n### Notes on CRUD methods of an Item\n\n`CRUD` stands for `Create, Read, Update and Delete`. In `openHAB` you can update an `Item` by using `postUpdate` or `sendCommand`. If you are working on your local instance you can run all `CRUD` methods. If you are using the openHAB Cloud you are limited to use `Read` and `Update`. By using the openHAB Cloud `Create` and `Delete` are not allowed.\n\n| CRUD method | HTTP request method        | Description  | Method | URL  |\n| :-----:| :-------------: |:-------------:| :-----:| :-----:|\n| `Create`  | `PUT`  |\tCreating a new item and add it to the item registry. |\t`n/a` | `https://\u003cbase_url\u003e/rest/items/{itemName}` |\n| `Read`  | `GET`  | Retrieve the state of an item. | `n/a` | `https://\u003cbase_url\u003e/rest/items/{itemName}/state` |\n| `Update`  | `PUT`  | The state of an item is updated. | `postUpdate` | `https://\u003cbase_url\u003e/rest/items/{itemName}/state` |\n| `Update`  | `POST` | A command is sent to an item via a channel. | `sendCommand` | `https://\u003cbase_url\u003e/rest/items/{itemName}` |\n| `Delete` | `DELETE` |\tDeleting an item and remove it from the item registry. |\t`n/a` | `https://\u003cbase_url\u003e/rest/items/{itemName}` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichdo93%2Fopenhab_postman_templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichdo93%2Fopenhab_postman_templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichdo93%2Fopenhab_postman_templates/lists"}