Clash of Clans icon

Clash of Clans

Comprehensive Clash of Clans API integration with advanced features

Overview

This node integrates with the Clash of Clans API to retrieve various types of game data. Specifically, the "Get Player Battle Log" operation fetches the battle log for a specified player, providing detailed information about recent battles they participated in. This is useful for players, clan leaders, or analysts who want to track player activity, review battle outcomes, or analyze performance trends.

Practical examples:

  • A clan leader monitoring members' recent battles to strategize upcoming wars.
  • A player reviewing their own battle history to improve tactics.
  • An analytics dashboard displaying recent player battles and statistics.

Properties

Name Meaning
Player Tag The unique identifier of the player whose battle log is being retrieved. Must start with #.
Pagination Parameters to control the number of results and pagination markers:
- Limit: Maximum number of battle log entries to return (minimum 1).
- After: Return only items occurring after this marker (for pagination).
- Before: Return only items occurring before this marker (for pagination).

Output

The output JSON contains an object with the following structure:

{
  "operation": "getPlayerBattleLog",
  "url": "https://api.clashofclans.com/v1/players/{playerTag}/battlelog",
  "data": { /* Battle log data from Clash of Clans API */ },
  "timestamp": "ISO timestamp when data was fetched",
  "metadata": {
    "operationType": "player",
    "apiVersion": "v1",
    "processedAt": "ISO timestamp"
  }
}
  • The data field holds the raw battle log response from the Clash of Clans API, which includes details such as battle types, participants, results, and timestamps.
  • No binary data is output by this node.

Dependencies

  • Requires an API key credential for the Clash of Clans API with appropriate permissions.
  • The node makes HTTP requests to the official Clash of Clans API endpoint (https://api.clashofclans.com/v1).
  • Proper configuration of the API token in n8n credentials is necessary.

Troubleshooting

  • Common issues:

    • Invalid or missing player tag (must start with #): The API will reject requests without a properly formatted player tag.
    • API authentication errors due to invalid or expired API token.
    • Pagination parameters may cause empty results if markers are incorrect or out of range.
    • Network connectivity issues affecting API calls.
  • Error messages:

    • "Operation 'getPlayerBattleLog' not supported": Indicates a misconfiguration or unsupported operation selected.
    • HTTP 401 Unauthorized: Check that the API token credential is valid and has not expired.
    • HTTP 404 Not Found: Usually means the player tag does not exist or is mistyped.
  • Resolutions:

    • Verify the player tag format and correctness.
    • Ensure the API token credential is correctly set up and active.
    • Adjust pagination parameters carefully to valid values.
    • Confirm network access to the Clash of Clans API endpoint.

Links and References

Discussion