BeachHead API Client
Installation
npm install bh-api
Description
Make calls against BeachHead's Call of Duty Clan Wars API to retreive information about current Clan Wars.
This package makes requests of a closed API that was reverse engineered. This means that it's subject to change and beyond my control.
Client Behavior
Some functions in this client emulate the behavior of the Advanced Warfare iOS app. The status
function's default behavior is to send a large amount of headers in each request and to poll the API for information 31 seconds ago. The endpoint that status
and events
call takes an epoch timestamp after /since/
which it uses to calculate activity between the present and that timestamp.
//ec2-api.prod.beachheadstudio.com/aw/clan_wars/waric/{clanId}/since/1442348741
Usage
This API inerface uses promises for a more imperative style and easier error handling.
var bhAPI = email password bhAPI
Endpoints
URLS where one can request information from BeachHead's Call of Duty API.
Login
Sending JSON credentials info to the following URLs will return a Cookie that is needed to request data from the other URLs
POST https://prod-api.prod.beachheadstudio.com/aw/si/login/
data = {email: "yourEmail", password: "yourPassword"}
Clan War Data
Send a request here to obtain information about an ongoing clan war. There are two dynamic parts to this endpoint; your clan's ID and a timestamp. This time stamp must be in epoch time, in the past, and must only be the first 10 digits of said epoch time.
GET https://ec2-api.prod.beachheadstudio.com/aw/clan_wars/waric/{clanId}/since/{epochTime}
Profile Info
A user id is required to request data from this endpoint
GET https://ec2-api.prod.beachheadstudio.com/aw/user/{userId}/stats
Sample response
Testing
We're using Mocha with Chai's Expect assertions and Nock for HTTPS response mocking. Nocks should be recorded on the first run and then saved to spec/replies/nocks.json
See the Nock documentation for usage.