Hello! I have gotten a cool idea recently which I wanted to share with you, the Hopscotch community. Me, myself, doesn´t know too much about HTTP requests, but I have used them before and I will do my best to tell you what it is.
What is HTTP Requests?
An HTTP request is basically data you send to a server or ask for from a server. There are many services based on this. Sending a request from a device to a server will make it interact with the server you do the HTTP request to. There are different types of requests, but the two main ones I think that Hopscotch should have (for simplicity) is GET and POST which basically means (Get data from a server or Post data from a server).
Every request sends some values to a server. Let´s say that you are fetching the weather from the Weather Underground API. By the way, an API is a service publicly available, often used to get or send data to interact with a service. An example HTTP request could be like this (don´t worry, these are all example codes for
the Weather Underground API, no personal API keys are used): http://api.wunderground.com/api/5756683d9b100348/conditions/q/CA/San_Francisco.json
As you see, we get lots of useful information, and if Hopscotch only could offer to extract a value from this file (like the value “weather”), we could make so much cool things with this!
How would this work in Hopscotch?
I know, I wrote lots of things above, but it´s worth to read in order to understand everything.
First, I think that we should have a request loop where you enter all the data to send to the server, like this:
In the blank space in the loop, it would be cool if you could choose between “GET” and “POST” as the request type.
In the loop, I think that there should be different blocks depending on the request type that you have chosen.
For Get and Post requests, I think that you should have the ability to send variables to a server, probably with a block saying “Send variable __________ = ___________” because you might need it for GET requests as well.
For Post requests, I think that we should have the ability to send more values to the server.
Somewhere, the HTTP request URL should also be mentioned. It would probably have to support variables in the URL as well.
Moderation and restrictions:
Many services do require an API key, an account and some even require payments. To make it fair for everyone, I think that those shouldn´t be allowed unless THT makes an API key for the whole community to use. Because someone can easily access your API account using the API key which would be publicly displayed in the code, unless The Hopscotch Team gave you the option to hide the API key which probably would make those allowed.
As HTTP requests can be made using a variety of services, all projects should be moderated before they get published in my opinion so that everyone is safe using the project. You should probably be given the ability to send a note to The Hopscotch Team so they know what API you´re using and in that way speed up the moderation.
Moderating HTTP Requests is a task that probably will be a little more complicated than images.
Thank you for reading this topic!
Remember, this is just a concept and I know what a huge task this is to implement. HTTP Requests is something that I think is cool though. I don´t know everything about HTTP requests and I might have gotten some things wrong. In that case, just tell me. Also, feel free to reply and ask me any questions or to say something else