-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Acces via url for integration on other software #42
Comments
@dcjona, This capability may already exist within the current firmware. If you want, take a look at the code in flaskUtils.py and in script.js. In order to change the board I utilize POST requests from the webpage (specically the javascript funtions) to the flask python server that is running. The code in flaskUtils interprets the incoming requests and does whatever function is requested (e.g. change the bg color, the text animation, the font, etc.) You should be able to make a POST request to http://ipaddress/api/bgcolor to change the BG color for example. Look in those two files above to see how it is done and how to utilize this. I may write some documentation that explains how to use this as well in case more people want to integrate this. |
thanks i will check that :) |
i check the two file ( i'm not a programmer, so maybee harder for me to understand) could you tell me what parameter must i transmis on the url to change the color ? http://ipaddress/api/bgcolor doesn"t work like that |
You are right it will not work when you type this directly into the URL bar. This is because when you type and address into a URL bar and hit Enter you are sending a GET HTML request to the flask server. I pointed you to my javascript file because a lot of these functions feature POST requests. https://www.diffen.com/difference/GET-vs-POST-HTTP-Requests This is how I send data to my server. Probably the biggest benefit is that in flaskUtils.py I do not have to have a separate route for each color or function that I want to set. With a "POST" request you can send multiple pieces of data through the form data and parse it out on the server side. I urge you to look at those two files again. All of this is to say, you need to find a way to send POST requests from your web page/application. This shouldn't be too hard to do as there are multiple examples of how to do this in script.js. Here is an example of what a post request looks like in the Chrome Inspector when I change the text color to Rainbow. You can see that it is a post request and that it sends specific data to the server. When you load the web page it performs a GET request to receive data. If you want to manually try POST requests you can do this via a Chrome Plugin like RestMan |
http://jsfiddle.net/ItsMcNugs/xq5rb7fm/5/ Here is an example of the green button from the website. You can see how each part of the web page works, the HTML, the CSS, and the JS together. This code should work, btw, if you change your clock IP address. Keep in mind that the JSFiddle code must be loaded as http:// not https:// for this snippet to work. |
Thanks a lot, i will search. With an api test i found the curl request ans everything work but i Can improve it will check your links |
Hi,
I would like to know if it's possible to intégrate to my automation system.
For that i need to access to the system by url e.g.
something like that : http://ipadress/green.xx
all balls will be in green
, changing also the color etc ...
do you think it's possible to make that ?
thank you very much for this awesome review of the ping pong clock
The text was updated successfully, but these errors were encountered: