Auto create Items with Channels using REST API

Tags: #<Tag:0x00007f1739507b28> #<Tag:0x00007f1739507a60> #<Tag:0x00007f1739507998>

Hello, any guidance on this below query would be really helpful. I am trying to find a way to create Items automatically using REST API (I will write an external service to do this). I am looking for some initial guidance on how to go about doing this.
For example, I have a Tesla binding added with a few things and items like this:

Thing: Thing tesla:models:1 “MyTesla” @ “Home” [ vin=“XXX”]
Item ex: Dimmer 1_SoC “State of Charge [%.1f %%]” {channel=“tesla:models:1:soc”}

If I were to go about creating this item (and potentially recurse thru all channels and create respective items) using Rest API how do I go about doing that? I understand I will need to use this API:
/items/createOrUpdateItem . But how would the json look like and how different will they have to be for each channel ?

Thanks in advance,
Rk.

Install the REST API Doc and you will see the params and other required bodies when you create the requests.

I did. but I am not able to follow the spec. for example, to add item: the body shows like this:
{
“type”: “string”,
“name”: “string”,
“label”: “string”,
“category”: “string”,
“tags”: [
“string”
],
“groupNames”: [
“string”
],
“groupType”: “string”,
“function”: {
“name”: “string”,
“params”: [
“string”
]
}
}

If I were to add an item following the format above for a Things’ item, how do I build the item, what does the “function” mean in that body and how do I include channels?

Go to another UI, like paperUI or HABmin. Add an item/thing/etc and monitor the request using Dev Tools or Fiddler

1 Like

thanks, let me try fiddler.

Thanks for suggesting devtools!