Returning Player's War Battlelog

Hello guys.

I’m developing my own script that communicates with Clash Royal API for managing my clan on CW2 - it’s personal content, no public or Royale API competition! heh I’m trying to know, per day, if my clan members completed all the four war battles.

How can I filter for war battles? I know there’s two types of war that is returning, but somehow I think I’m getting non-war battles on those battle types. I understand I need to divide cards on duel per 8, to know how many games happened on that duel. But as I said, I’m struggling to filter war games only.

Can you share some tips with me?

You can’t filter the war battles on the API, but you can filter the responses.

Based on the current API response structure, you can try to filter by type:

type: riverRacePvP
type: riverRaceDuel

For duels, you can calculate the number of battles used by dividing the length of team cardss by 8.

Battles with riverRacePvP will further be broken down into different game modes: TripleElixir_Ladder CW_Battle_1v1 Rage_Ladder

if you want to know what modes your members have played.

In order to ensure that you have all the battles played by the players, you should make a request for each player every hour. In order to not trigger any potential rate limits, you should space out your requests (i.e. don’t parallel fetch 1000 requests in a second)


God damn. I’m sorry I’ve wasted your time.
I’ve got all that information by querying API, but I was getting strange results. Everything was what I was filtering. Everything.
That’s when I’ve realized that I was trying to compare (I’m using Powershell) with “=” and in PowerShell the logical comp. operator is “-eq”. I was not even using “==” to not look bad on the picture. My bad.

Excelent explanation by the way. Thank you!

When working with REST APIs, the best tool to use would be

With postman, you don’t need to worry about your command line syntax, and you can save your api keys inside a collection. So you can easily add endpoints without having to worry about copying your keys all the time.

Plus it will format the JSON returned in a human readable way automatically. Or allow you to save the responses for local testing. There are too many features to mention and it’s indispensable for development.

Highly recommended.

1 Like