Instruction
Collectapi is a platform where you can browser apis as well as connect, share and more. You need to login to your collectapi account to do all of these awesome things.
Profile
After registration and login now we can start to poke things around but first we will need our token to access apis.
To obtain it, open your profile with clicking Accounts -> Profile
On profile page, you can
- Change account information
- Get your token
- Link account
Token
Your token is the one of two most important thing to interact with any api on the collectapi. The other one is your package type. There is currently 4 package types:
- Free
- Basic
- Premium
- Enterprise
Your package type affect to how many apis you can access to. You can see the list on pricing page.
You can get your token from Profile -> Token Tab
How to Use
Passing this token with header on your calls will grant you to access. Let me show you with one example on weather api.
Get request to 'weather/getWeather' endpoint with our Token :
curl -X GET \
'https://api.collectapi.com/weather/getWeather?data.city=ankara' \
-H 'Authorization: {Your Token Here}'
The Result:
{
"success": true,
"result": [
{
"date": "20.02.2019",
"day": "Çarşamba",
"icon": "https://image.flaticon.com/icons/svg/143/143769.svg",
"description": "açık",
"status": "Clear",
"degree": "13.26",
"min": "-4.11",
"max": "13.26",
"night": "-4.11",
"humidity": "41"
},
{
"date": "21.02.2019",
"day": "Perşembe",
"icon": "https://image.flaticon.com/icons/svg/143/143769.svg",
"description": "açık",
"status": "Clear",
"degree": "8.84",
"min": "-7.38",
"max": "9.61",
"night": "-3.58",
"humidity": "51"
},
{
"date": "22.02.2019",
"day": "Cuma",
"icon": "https://image.flaticon.com/icons/svg/143/143786.svg",
"description": "az bulutlu",
"status": "Clouds",
"degree": "5.33",
"min": "-8.66",
"max": "7.98",
"night": "-3.32",
"humidity": "59"
},
{...}
]
}
As you can see above, passing your token on the headers with Authorization
keyword, we could use the weather api's 'getWeather' endpoint and get the result with anything else. That's it. You can use it wherever you want.