Creating a Rest Request
REST API platform
To Create a REST request,
- Select a Collection, On hover user will see an icon to create a request.
- Click on the icon will open a dialog box.
- Provide label and save to create a request.
- Navigate to the created request and select it.
- Now provide the necessary data like
Method, URL, Port, Params, Headers, Body etc.
to configure the created request. - Click
Save
button to save the request.
Now try it yourself, copy the below API endpoint and create a GET
request.
https://dummyjson.com/
Pokemon API
Let's try another API.
We'll be using the Pokemon API, go ahead and create a GET
request to the endpoint below:
https://pokeapi.co/api/v2
If your request was successful, then you should get a JSON response as shown below:
{
"ability": "https://pokeapi.co/api/v2/ability/",
"berry": "https://pokeapi.co/api/v2/berry/",
...
"pokedex": "https://pokeapi.co/api/v2/pokedex/",
"pokemon": "https://pokeapi.co/api/v2/pokemon/",
...
"version-group": "https://pokeapi.co/api/v2/version-group/"
}
Image 1 :
The Pokemon API has returned us three new API endpoints or URLs, let's pick the characters URL and explore it.
Now, let's create a GET
request to the characters URL, append /pokemon
to the URL you already have on PruTAN or copy paste the URL below:
https://pokeapi.co/api/v2/pokemon
The API should have returned a huge amount of data, something similar to the one below:
{
"count": 1279,
"next": "https://pokeapi.co/api/v2/pokemon?offset=20&limit=20",
"previous": null,
"results": [
{
"name": "bulbasaur",
"url": "https://pokeapi.co/api/v2/pokemon/1/"
},
{
"name": "ivysaur",
"url": "https://pokeapi.co/api/v2/pokemon/2/"
},
...
...
}
Image 2 :
Try experimenting with the /pokedex
, /berry
and the other sendpoints as well.
REST & HTTP Protocols
Learn more about REST and HTTP protocols.