Connect Rest with Clash of clans Part 1

 In this Post , We are gonna use API from Clash of Clans and Use Postman to check if API works.

What is clash of clans (COC) ?

Clash of Clans is an online strategy game for mobile. Well if you have no idea how this game is played, in brief, a Clasher has a village and an army. Clashers attack each other’s villages in multiplayer battles, form clans together, participate in wars against other clans, and lead their clans to victory.




How to access the clash of clans API ?

 

Registration an developer account with Clash of clans



Create an API token to access the Clash of clans API

  • Login to clash of clans
  • Navigate to Account name and Select My account
  • Under my account , Create New Key
  • Provide Name , Description and for allowed IP Address check the IP address from https://whatismyipaddress.com
  • click create key and copy the token to a notepad.





To check the list of API provided by clash of clans

From the list of operations , I have selected two simple operations.

  1.  To get information about all the locations
  2.  To get the information about the player rankings for a specific location



Using Postman To check if API works

Create new request and give the End point URL: https://api.clashofclans.com/v1/locations



In the Authorization tab, select the type as Bearer token and provide the token from notepad.


Click send to check if status is 200 (connected successfully) and the response is returned in JSON format.



Food for thought : In the same way, you can use the other API's from clash of clans and use postman to check if API response is received or not.


In the below post , we will see how pega can use the clash of Clans API and display the results.

https://welearnpega.blogspot.com/2021/01/connect-rest-with-clash-of-clans-part-2.html

Post a Comment