-->
Page 1 of 1

RestClient library for ESP8266 Arduino

PostPosted: Tue Aug 25, 2015 1:55 pm
by dakazmier
For those of your wanting/needing to do REST based communications FROM your ESP8266 (as opposed to into it) - this library should expedite that:

https://github.com/DaKaZ/esp8266-restclient

Enjoy...

Re: RestClient library for ESP8266 Arduino

PostPosted: Sat Jul 15, 2017 6:28 pm
by kodak
i want to send simple commands from a webpage to control my DNLA / upnp produckts,

When i use this guide it works:

Code: Select allA - Use Google Chrome
    A1. Install Google Chrome
    A2. Install Simple Rest Client (https://chrome.google.com/webstore/detail/simple-rest-client/fhjcajmcbmldlhcimfajhfbgofnpcjmb)
    A3. Once Simple Rest Client is installed you should a blue globe looking icon to the right of the URL field in Chrome. Click on that icon.
    A4. In the URL field of the REST Client, type in http://192.168.168.198/sony/accessControl
        where you replace 192.168.168.198 with IP address of your TV.
    A5. Click on POST.
    A6. In the DATA field paste:

    {"id":13,"method":"actRegister","version":"1.0","params":[{"clientid":"iRule:1","nickname":"iRule"},[{"clientid":"iRule:1","value":"yes","nickname":"iRule","function":"WOL"}]]}

    A7. Hit SEND. You should see a message on TV pop-up with PIN code and a Username and Password message pop-up in the Browser.
    Leave Username blank and in password field put in the PIN code that is displayed on TV.


B -To find out what codes your TV can accept, go to Rest again and:
    B1. In the URL field of the REST Client, type in http://192.168.168.198/sony/system
        where you replace 192.168.168.198 with IP address of your TV.
    B2. Click on POST.
    B3. In the Headers field type:
        SOAPAction: "urn:schemas-sony-com:service:IRCC:1#X_SendIRCC"
    B4. In the Data field type:
        {"method":"getRemoteControllerInfo","params":[],"id":10, "version":"1.0"}
    B5. Hit SEND. You should see a big list of codes in the result box, like in the attached picture.


C - To test your codes work, go to REST again, and:
    C1. In the URL field of the REST Client, type in http://192.168.168.198/sony/IRCC
        where you replace 192.168.168.198 with IP address of your TV.
    C2. Click on POST.
    C3. In the Headers field type:
        SOAPAction: "urn:schemas-sony-com:service:IRCC:1#X_SendIRCC"
    C4. In the Data field type:
        <?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1"><IRCCCode>AAAAAQAAAAEAAAAuAw==</IRCCCode></u:X_SendIRCC></s:Body></s:Envelope>

    C5. Replace the code between on the line beginning <IRCCCode>:
        AAAAAQAAAAEAAAAuAw==
        with whichever code your TV can accept, that you discovered with the getRemoteControllerInfo method. The one above is the discrete power on, "WakeUP".
        There is no WOL with my model, a KDL65W850C.
    C6. Hit SEND. Your TV should turn on, and stay on ,if sent again.

But i want it to be a web script, so when i goto something like "http://example.com/dlna.php?unitip=192.168.168.198&cmd=SendIRCC&code=AAAAAQAAAAEAAAAuAw==" I then want it to do the same as the C part.

and when i goto something like "http://example.com/dlna.php?unitip=192.168.168.198&cmd=AS&clientid=iRule:1&nickname=iRule" I then want it to do the same as the A part.

and when i goto something like "http://example.com/dlna.php?unitip=192.168.168.198&cmd=gRCI" I then want it to do the same as the B part.

Hope that any one can se what i meen and help me create it.