Use external API to populate items

I want to execute an API call and use this info to populate some items, although I need to do some scripting on the json output before it’s usable for items.
I want to use Jython for this, but how can I view the result of this script in OH3 (I can run it, but don’t see any result) and how can I assign values to items?

What do you mean? Are you trying to create the items? or are you trying to use the API to update/post/publish data to items that already exist?

2nd one. So I want to use the data which I receive from a GET call and put it in items

I havn’t yet done this in Python, but I’m doing this in bash at the moment with a basic curl post command. I have a simple bash script I use to push and get items and payload. Here it is if this helps you.

rename to api.sh and make executable for linux

api.txt (1.4 KB)

Alternatively you can use the python requests library to post directly

thanks, I’ll check you script. I hoped that there was a better integration with the items in OH directly. Maybe I’ll check how to do it with javascript, this seems to be more integrated if I look to the code wich is generated by blocky.

Check out HABApp, there are functions which will help you do what you want.