1.5.162 • Published 4 years ago

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

Weekly downloads
474
License
-
Repository
-
Last release
4 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

4 years ago

1.5.161

4 years ago

1.5.160

4 years ago

1.5.159

4 years ago

1.5.158

4 years ago

1.5.149

4 years ago

1.5.157

4 years ago

1.5.156

4 years ago

1.5.155

4 years ago

1.5.154

4 years ago

1.5.153

4 years ago

1.5.150

4 years ago

1.5.139

4 years ago

1.5.148

4 years ago

1.5.147

4 years ago

1.5.146

4 years ago

1.5.145

4 years ago

1.5.144

4 years ago

1.5.143

4 years ago

1.5.142

4 years ago

1.5.141

4 years ago

1.5.140

4 years ago

1.5.138

4 years ago

1.5.137

4 years ago

1.5.136

4 years ago

1.5.135

4 years ago

1.5.134

4 years ago

1.5.133

4 years ago

1.5.132

4 years ago

1.5.130

4 years ago

1.5.129

4 years ago

1.5.128

4 years ago

1.5.127

4 years ago

1.5.126

4 years ago

1.5.125

4 years ago

1.5.124

4 years ago

1.5.122

4 years ago

1.5.120

4 years ago

1.5.119

4 years ago

1.5.118

4 years ago

1.5.117

4 years ago

1.5.115

4 years ago

1.5.114

4 years ago

1.5.112

4 years ago

1.5.111

4 years ago

1.5.109

4 years ago

1.5.110

4 years ago

1.5.108

4 years ago

1.5.107

4 years ago

1.5.106

4 years ago

1.5.105

4 years ago

1.5.104

4 years ago

1.5.103

4 years ago

1.5.102

4 years ago

1.5.101

4 years ago

1.5.100

4 years ago

1.5.99

4 years ago

1.5.98

4 years ago

1.5.97

4 years ago

1.5.96

4 years ago

1.5.95

4 years ago

1.5.94

4 years ago

1.5.92

4 years ago

1.5.91

4 years ago

1.5.90

4 years ago

1.5.89

4 years ago

1.5.87

4 years ago

1.5.86

4 years ago

1.5.85

4 years ago

1.5.84

4 years ago

1.5.81

4 years ago

1.5.83

4 years ago

1.5.82

4 years ago

1.5.79

4 years ago

1.5.78

4 years ago

1.5.77

4 years ago

1.5.76

4 years ago

1.5.74

4 years ago

1.5.75

4 years ago

1.5.73

4 years ago

1.5.72

4 years ago

1.5.70

4 years ago

1.5.49

4 years ago

1.5.50

4 years ago

1.5.52

4 years ago

1.5.51

4 years ago

1.5.54

4 years ago

1.5.53

4 years ago

1.5.56

4 years ago

1.5.55

4 years ago

1.5.58

4 years ago

1.5.57

4 years ago

1.5.59

4 years ago

1.5.61

4 years ago

1.5.60

4 years ago

1.5.63

4 years ago

1.5.62

4 years ago

1.5.65

4 years ago

1.5.64

4 years ago

1.5.67

4 years ago

1.5.66

4 years ago

1.5.69

4 years ago

1.5.68

4 years ago

1.5.40

4 years ago

1.5.47

4 years ago

1.5.48

4 years ago

1.5.39

4 years ago

1.5.38

4 years ago

1.5.37

4 years ago

1.5.36

4 years ago

1.5.34

4 years ago

1.5.35

4 years ago

1.5.33

4 years ago

1.5.32

4 years ago

1.5.31

4 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