REST Api Curl-Qt

238 views
Skip to first unread message

Carlos E. Hernandez I.

unread,
Nov 22, 2015, 2:43:00 PM11/22/15
to WebIOPi
Hi guys.

I'm working at a project of control Rasberry Pi GPIO's pins by my computer using WebIOPi. I'm a C++/Qt developer and I don't wanna to try Python and HTML stuffs.

Instead, I'd like to use the REST Api, So I found a interesting post where he used Curl to check if the WebIOPi responds and then he used Qt.

In that way I installed Curl and then I tried to change the function of GPIO4 with this setence:

curl -v -X POST -u webiopi:raspberry http://10.42.43.112:8000/GPIO/4/function/out

but it's showing this and I don't see any change in the GPIO status web.

* Hostname was NOT found in DNS cache
*   Trying 10.42.43.112...
* Connected to 10.42.43.112 (10.42.43.112) port 8000 (#0)
* Server auth using Basic with user 'webiopi'
> POST /GPIO/4/function/out HTTP/1.1
> Authorization: Basic d2ViaW9waTpyYXNwYmVycnk=
> User-Agent: curl/7.38.0
> Host: 10.42.43.112:8000
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: WebIOPi/0.7.1/Python3.4
< Date: Thu, 24 Sep 2015 21:48:16 GMT
< Cache-Control: no-cache
< Content-Type: None
< Content-Length: 2
<
* Closing connection 0


At the moment,the daemon is running with the setence

sudo webiopi -d -c /etc/webiopi/config

and seeing throught Remmina with a VNC server...

May I ask for some help? Thank You

Carlos E. Hernandez I.

unread,
Dec 12, 2015, 11:34:30 AM12/12/15
to WebIOPi
Thank you Guys. I was on the school but now I'm having another chance to set it up...

At the moment, I started the daemon and I got this output...


*   Trying 10.42.43.112...
* Connected to 10.42.43.112 (10.42.43.112) port 8000 (#0)
* Server auth using Basic with user 'webiopi'
> POST /GPIO/18/function/out HTTP/1.1
> Host: 10.42.43.112:8000
> Authorization: Basic d2ViaW9waTpyYXNwYmVycnk=
> User-Agent: curl/7.43.0

> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 403 Channel 18 is not allowed
< Server: WebIOPi/0.7.1/Python3.4
< Date: Fri, 25 Sep 2015 05:35:31 GMT
< Content-Type: text/html;charset=utf-8
< Connection: close
< Content-Length: 482
<
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <title>Error response</title>
    </head>
    <body>
        <h1>Error response</h1>
        <p>Error code: 403</p>
        <p>Message: Channel 18 is not allowed.</p>
        <p>Error code explanation: 403 - Request forbidden -- authorization will not help.</p>
    </body>
</html>
* Closing connection 0

Any suggestion will be accepted

Carlos E. Hernandez I.

unread,
Dec 14, 2015, 6:45:15 PM12/14/15
to WebIOPi
Reply all
Reply to author
Forward
0 new messages