thingsboard_api_tools
thingsboard_api_tools copied to clipboard
can you add relation api ?
it is a great job for accessing thingsboard, i really appreciated you. Now i need init many asset and device by api,but i found there is no relation in your code. can you add relation api ? Thanks!
Hey, hope it is not late, but relation can be added like this:
relations = {"from": {"id": from_entity_id, "entityType": from_entity_type}, "type": "Contains", "to": {"entityType": to_entity_type, "id": to_entity_id}}
relations_r = requests.post('http://127.0.0.1:8080/api/relation', json=relations, headers=headers)
headers should be the usual part as is in the code.