1.5.162 • Published 3 years ago

@ftw-cloud/cod-mw-api v1.5.162

Weekly downloads
474
License
-
Repository
-
Last release
3 years ago

Call Of Duty API Wrapper

Call of Duty Api is a promised based wrapper for the "private" API that Activision use on the callofduty.com website.

Install

npm install call-of-duty-api

Initialize Module

const API = require("call-of-duty-api")();

or

const API = require("call-of-duty-api")({ platform: "battle" });

List of Platforms

  • psn
  • steam
  • xbl
  • battle
  • uno (activision ID)
//How to access
API.platforms.psn;

Please note: uno is for looking up via activision ID and this is only supported on a couple of endpoints.

Supported Endpoints for activision ID

  • MWcombatmp
  • MWcombatwz
  • MWmp
  • MWwz
  • MWstats

Login

  • This needs to be your activision account, not your platform login.
 const API = require('call-of-duty-api')();
 API.login("<email>", "<password>").then(<?>).catch(<?>);

Rate limiting

I have implemented axios-rate-limit incase you want to implement your own rate limitting. All you need to do is pass a ratelimit object when initializing the module.

const API = require("call-of-duty-api")({
  platform: "battle",
  ratelimit: { maxRequests: 2, perMilliseconds: 1000, maxRPS: 2 },
});

You can find out more about axios-rate-limit here

Get Stats

API.MWstats(<gamertag>, API.platforms.<platform>).then((output) => {
    console.log(output);
}).catch((err) => {
    console.log(err);
});

Output

{
    title: 'mw',
    platform: 'platform',
    username: 'gamertag',
    mp:
    { lifetime: { all: [Object], mode: [Object] },
    weekly: null,
    level: 0,
    maxLevel: 0,
    levelXpRemainder: 0,
    levelXpGained: 0,
    prestige: 0,
    prestigeId: 0,
    maxPrestige: 0 },
    zombies:
    { lifetime: { all: [Object], mode: {} },
    weekly: { all: [Object], mode: {} } },
    engagement: { timePlayedAll: 440544, seasonPass: 1 }
}

Example Project

const API = require("call-of-duty-api")({ platform: "battle" });
//I want Warzone Data
API.MWBattleData("Lierrmm#2364")
  .then((data) => {
    console.log(data); // see output
  })
  .catch((err) => {
    console.log(err);
  });

Output

[
  (br: {
    wins: 1,
    kills: 77,
    kdRatio: 1.2833333333333334,
    downs: 70,
    topTwentyFive: 20,
    topTen: 11,
    contracts: 15,
    revives: 0,
    topFive: 6,
    score: 55600,
    timePlayed: 27169,
    gamesPlayed: 20,
    scorePerMinute: 122.78699988958003,
    cash: 0,
    deaths: 60,
    title: "br",
  }),
  (br_dmz: {
    wins: 0,
    kills: 9,
    kdRatio: 1.2857142857142858,
    downs: 11,
    topTwentyFive: 0,
    topTen: 0,
    contracts: 2,
    revives: 0,
    topFive: 0,
    score: 4574,
    timePlayed: 1786,
    gamesPlayed: 1,
    scorePerMinute: 153.66181410974244,
    cash: 53,
    deaths: 7,
    title: "br_dmz",
  }),
  (br_all: {
    wins: 1,
    kills: 86,
    kdRatio: 1.2835820895522387,
    downs: 81,
    topTwentyFive: 20,
    topTen: 11,
    contracts: 17,
    revives: 0,
    topFive: 6,
    score: 60174,
    timePlayed: 28955,
    gamesPlayed: 21,
    scorePerMinute: 124.6914177171473,
    cash: 53,
    deaths: 67,
    title: "br_all",
  }),
];
1.5.162

3 years ago

1.5.161

3 years ago

1.5.160

3 years ago

1.5.159

3 years ago

1.5.158

3 years ago

1.5.149

3 years ago

1.5.157

3 years ago

1.5.156

3 years ago

1.5.155

3 years ago

1.5.154

3 years ago

1.5.153

3 years ago

1.5.150

3 years ago

1.5.139

3 years ago

1.5.148

3 years ago

1.5.147

3 years ago

1.5.146

3 years ago

1.5.145

3 years ago

1.5.144

3 years ago

1.5.143

3 years ago

1.5.142

3 years ago

1.5.141

3 years ago

1.5.140

3 years ago

1.5.138

3 years ago

1.5.137

3 years ago

1.5.136

3 years ago

1.5.135

3 years ago

1.5.134

3 years ago

1.5.133

3 years ago

1.5.132

3 years ago

1.5.130

3 years ago

1.5.129

3 years ago

1.5.128

3 years ago

1.5.127

3 years ago

1.5.126

3 years ago

1.5.125

3 years ago

1.5.124

3 years ago

1.5.122

3 years ago

1.5.120

3 years ago

1.5.119

3 years ago

1.5.118

3 years ago

1.5.117

3 years ago

1.5.115

3 years ago

1.5.114

3 years ago

1.5.112

3 years ago

1.5.111

3 years ago

1.5.109

3 years ago

1.5.110

3 years ago

1.5.108

3 years ago

1.5.107

3 years ago

1.5.106

3 years ago

1.5.105

3 years ago

1.5.104

3 years ago

1.5.103

3 years ago

1.5.102

3 years ago

1.5.101

3 years ago

1.5.100

3 years ago

1.5.99

3 years ago

1.5.98

3 years ago

1.5.97

3 years ago

1.5.96

3 years ago

1.5.95

3 years ago

1.5.94

3 years ago

1.5.92

3 years ago

1.5.91

3 years ago

1.5.90

3 years ago

1.5.89

3 years ago

1.5.87

3 years ago

1.5.86

3 years ago

1.5.85

3 years ago

1.5.84

3 years ago

1.5.81

3 years ago

1.5.83

3 years ago

1.5.82

3 years ago

1.5.79

3 years ago

1.5.78

3 years ago

1.5.77

3 years ago

1.5.76

3 years ago

1.5.74

3 years ago

1.5.75

3 years ago

1.5.73

3 years ago

1.5.72

3 years ago

1.5.70

3 years ago

1.5.49

3 years ago

1.5.50

3 years ago

1.5.52

3 years ago

1.5.51

3 years ago

1.5.54

3 years ago

1.5.53

3 years ago

1.5.56

3 years ago

1.5.55

3 years ago

1.5.58

3 years ago

1.5.57

3 years ago

1.5.59

3 years ago

1.5.61

3 years ago

1.5.60

3 years ago

1.5.63

3 years ago

1.5.62

3 years ago

1.5.65

3 years ago

1.5.64

3 years ago

1.5.67

3 years ago

1.5.66

3 years ago

1.5.69

3 years ago

1.5.68

3 years ago

1.5.40

3 years ago

1.5.47

3 years ago

1.5.48

3 years ago

1.5.39

3 years ago

1.5.38

3 years ago

1.5.37

3 years ago

1.5.36

3 years ago

1.5.34

3 years ago

1.5.35

3 years ago

1.5.33

3 years ago

1.5.32

3 years ago

1.5.31

3 years ago

1.5.30

4 years ago

1.5.29

4 years ago

1.5.28

4 years ago

1.5.27

4 years ago

1.5.26

4 years ago

1.5.25

4 years ago

1.5.24

4 years ago

1.5.22

4 years ago

1.5.21

4 years ago

1.5.20

4 years ago

1.5.19

4 years ago

1.5.18

4 years ago

1.5.17

4 years ago

1.5.16

4 years ago

1.5.15

4 years ago

1.5.13

4 years ago

1.5.12

4 years ago

1.5.11

4 years ago

1.4.10

4 years ago

1.5.9

4 years ago

1.5.8

4 years ago

1.5.7

4 years ago

1.5.6

4 years ago

1.5.5

4 years ago

1.5.4

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.4.9

4 years ago