Need some help to post JSON in some kind of way (python?)

Posted on
Mon Nov 15, 2021 1:49 pm
VincentS offline
Posts: 45
Joined: Dec 11, 2014

Need some help to post JSON in some kind of way (python?)

Hi everybody,

I have a simple question at least for some of you.

I need to post a http JSON to a device in my home. Sins I have no programming skills I need some help here.

my URL to post to is :

http://192.168.1.106:8090/json-rpc

The payload body is:

{
"command":"color",
"color":[0,0,255],
"priority":50,
"origin":"Hyperion server"
}

I tested is with restclient in Firefox and everything works but I need a way to do this from within Indigo. Is there a way to send JSON from Indigo or do I need a Python script to do this. And if so could someone help me to set this up

Kind regards
Vincent

Posted on
Mon Nov 15, 2021 2:04 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Need some help to post JSON in some kind of way (python?

This Python script should do it (assuming there's no authentication):

Code: Select all
import json
import requests
url = "http://192.168.1.106:8090/json-rpc"
payload = {
    "command": "color",
    "color": [0, 0, 255],
    "priority": 50,
    "origin": "Hyperion server"
}
reply = requests.post(url, json=payload)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Nov 15, 2021 2:13 pm
VincentS offline
Posts: 45
Joined: Dec 11, 2014

Re: Need some help to post JSON in some kind of way (python?

Thanks Jay.!!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 9 guests

cron