Installing Pycairo In Windows

Using sketchware Request Network component - API requests


reqest network component help
Yeah! I think many would have been wondering what is the RequestNetwork component. This is seen in the component tab. You could have clicked on the "MOVE TO DOCS" button but the disappointment is that it says "The docs page will be updated soon". Before entering the component name it would say some info about it as "RequestNetwork is used to make Web API calls". On reading it you would think that we can make web calls very easily as calling a person. But it is actually not so. You have come here to learn what is that RequestNetwork component.
dialougue of request network

Now as the small info says it is used to make WEB API CALLS actually web API call is quite complicated to understand. Sketchware uses the best way to connect to the web and this is to congratulate the developers. RequestNetwork component is used to connect to a URL. For example, here I connect to "https://httpbin.org/get" (A simple HTTP Request & Response Service.). See the screenshot.
get method
 Here we get a JSON file by which we can parse the data. Sketchware has a default way for parse JSON. For now, lets whats are blocks when we create a RequestNetwork component. After creating one you would see these blocks.
blocks in request component sketchware

Now let's explore each of the blocks.
Here, the first block we would see is RequestNetwork set params to request params type. This block helps in setting the content of the request. These are the things that are after the URL and question mark. These are called the parameters for the requests which usually contain API-keys and other things. These are defined in a map variable.

Next, is the set headers block. This block sets the headers for the requests. The headers can contain user-agent,content-type and other things to verify that the app in which it runs is your own. If you are posting data you have set these.

Finally, this is the main part of the request. The hostname or URL is entered in this place. Now the app will send the request with the headers/parameters previously set to the URL. The reply from the server is then handled here.
On response and on error response

Next, we shall check out onResponse and onErrorResponse in the components tab. The result from the URL can be handled here. We use JSON Operator tab. We can convert the JSON response to list map. Now we can build this create API applications. Check out dog.ceo and try working with it.
on response

See you in the next post, Bye!!

Comments

This Blog is protected by DMCA.com

Donate Me

Donate Me
Do something Great