{"id":17967595,"url":"https://github.com/CaptEmulation/clash-of-clans-api","last_synced_at":"2025-03-25T08:31:21.562Z","repository":{"id":3950507,"uuid":"51489996","full_name":"CaptEmulation/clash-of-clans-api","owner":"CaptEmulation","description":":star::star::star: Clash of Clans :rage1: API NodeJS helper","archived":false,"fork":false,"pushed_at":"2023-03-05T16:32:07.000Z","size":419,"stargazers_count":65,"open_issues_count":7,"forks_count":26,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-16T06:14:16.407Z","etag":null,"topics":["clash-of-clans","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CaptEmulation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-02-11T02:41:52.000Z","updated_at":"2025-02-19T06:57:00.000Z","dependencies_parsed_at":"2023-07-05T19:18:15.754Z","dependency_job_id":null,"html_url":"https://github.com/CaptEmulation/clash-of-clans-api","commit_stats":{"total_commits":64,"total_committers":10,"mean_commits":6.4,"dds":0.390625,"last_synced_commit":"4b072f7c693b4a187f4aaf01184d57610e2e9262"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptEmulation%2Fclash-of-clans-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptEmulation%2Fclash-of-clans-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptEmulation%2Fclash-of-clans-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptEmulation%2Fclash-of-clans-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CaptEmulation","download_url":"https://codeload.github.com/CaptEmulation/clash-of-clans-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245426254,"owners_count":20613318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clash-of-clans","nodejs"],"created_at":"2024-10-29T14:09:08.655Z","updated_at":"2025-03-25T08:31:21.230Z","avatar_url":"https://github.com/CaptEmulation.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Introduction\n\nProvides an easy way to get started with the [Clash of Clans API](https://developer.clashofclans.com)\n\n# Installation\n\n`npm install --save clash-of-clans-api`\n\n# Usage\n\nAll fetches return a promise using [request-promise](https://www.npmjs.com/package/request-promise)\n\n## Instantiation\n\nIn order to get started with Clash of Clans API, you need to create an account at [developer.clashofclans.com](https://developer.clashofclans.com) and create a key.  You will need the IP of the host using to connect to the services.\n\nOnce you get your token, you have two choices.\n - Set the *COC_API_TOKEN* env variable\n - Pass in a token option when creating the ClashApi object\n\nExample:\n\n```\nimport clashApi from 'clash-of-clans-api';\nlet client = clashApi({\n  token: yourApiToken // Optional, can also use COC_API_TOKEN env variable\n});\n```\n\nIn addition, if you need to pass in any additional options to `request` (for example to set a proxy) then you can use the `request` option to do so:\n\n```\nimport clashApi from 'clash-of-clans-api';\nlet client = clashApi({\n  request: {\n    proxy: process.env.MY_PROXY,\n  },\n});\n```\n\nSee [request options](https://github.com/request/request#requestoptions-callback) for the full list of supported request options\n\n## Clan Search\n\nThere is a DSL for performing clan searches.  At least one filtering criteria must be defined and if name is used as part of search, it is required to be at least three characters long.\n\nSee https://developer.clashofclans.com/api-docs/index.html#!/clans/searchClans\n\nExample:\n```\nclient\n  .clans()\n  .withWarFrequency('always')\n  .withMinMembers(25)\n  .fetch()\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err))\n```\n\nAll query parameters are supported, simply prepend `with` and capitalize the first letter of the query param.  Complete the request with a call to `fetch()`.\n\n## Clan by Tag\n\nRequest clan details by clan tag.  Be sure to include the hashtag `#`.\n\nExample:\n```\nclient\n  .clanByTag('#UPC2UQ')\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err));\n```\n\n## Clan Members by Tag\n\nRequest clan member details by clan tag.  Be sure to include the hashtag `#`.\n\nExample:\n```\nclient\n  .clanMembersByTag('#UPC2UQ')\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err));\n```\n\n## Clan Warlog by Tag\n\nRequest clan warlog by clan tag.  Be sure to include the hashtag `#`.\n\nExample:\n```\nclient\n  .clanWarlogByTag('#UPC2UQ')\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err));\n```\n\n## Current War by Tag\n\nRequest current war information by clan tag.  Be sure to include the hashtag `#`.\n\nExample:\n```\nclient\n  .clanCurrentWarByTag(`#UPC2UQ`)\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err));\n```\n\n## Clan War Leagues support\n\nRequest the current clan war leagues the clan is participating in.\n\nExample:\n```\nclient\n  .clanLeague(`#UPC2UQ`)\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err));\n  \n// Response contains response.rounds[].warTags[]. Each of the warTags \n// can be used to retrieve further information about the league war.\nclient\n  .clanLeagueWars(response.rounds[0].warTags[0])\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err));\n``` \n\n## Location\n\nLocation has a DSL for requesting location details\n\nExamples:\n\n```\n// Request all location details\nclient\n  .locations()\n  .fetch()\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err));\n\n// Request details for a single location\nclient\n  .locations()\n  .withId(locationId)\n  .fetch()\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err));\n\n// Request clan details for a single location\nclient\n  .locations()\n  .withId(locationId)\n  .byClan()\n  .fetch()\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err));\n\n// Request player details for a single location\nclient\n  .locations()\n  .withId(locationId)\n  .byPlayer()\n  .fetch()\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(err));\n```\n\n## Tutorial for complete beginners\nhttps://medium.com/@alexionutale/how-to-use-clash-of-clans-api-cd4fe7406576?source=friends_link\u0026sk=c12a0c2a736658681878f20cc98af08f\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCaptEmulation%2Fclash-of-clans-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCaptEmulation%2Fclash-of-clans-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCaptEmulation%2Fclash-of-clans-api/lists"}