- What is MooN ?
- Introduction
- Differences between routes
- How to use ?
- Working with events
- Installation
MooN is a project that aims to provide a lot of tools to manage data from the official Call of Duty API. Its API was about to be this project, but I decided to turn it into a whole wrapper for the official Call of Duty API. MooN project will provide a graphical desktop application in which you'll be able to use the API in one hand, and recover data in the other hand like codTracker does. But it doesn't stop there, the Moon Project will allow 'blueprints' programming, which means that you'll be able to customize your request and apply tons of filters, conditions, calculations, etc... to your data. As this needs a huge amount of work this won't be available before a long time.
This project is an abstract layer API used to retrieve and manage data from official Call of Duty API. Please consider this as an unfinished project, as it is still under development.
You are free to contribute to this project.
This project has been created in order to help OtherGun making his video on Modern Warfare 2019.
Call of Duty API use 3 different routes to retrieve data. Public, Private and Protected.
- Private routes may only be accessed by the authenticated client as they contain data specific to the client's account.
- Protected routes require an authenticated client but may supply data for any given player.
- Public routes require no authenticated or initialization and can be interfaced without prior consideration.
This library provides you classes for each Call of Duty game that work with the API. Each class contains methods compatible with the title. In addition, it is also possible to perform operations on users.
Protected and Private routes require an authenticated client. This is why some methods require a ssoToken
parameter.
SSO Token is a token linked to your Activision account that is unique and must not be shared. Since last year, Activision has
implemented a captcha system to their authentication page to prevent automated requests. Getting your SSO Token from there is no longer possible.
Since there is no other proper way to get your SSO Token, you'll have to get it manually. You can follow the steps below to get your SSO Token:
- Go to https://profile.callofduty.com/cod/login
- Authenticate using your credentials
- Right click and inspect the page, go to
Storage
->Cookies
and search for ACT_SSO_COOKIE
For instance, if you want to retrieve data from Black Ops 3, you'll have to instanciate a BlackOps3
object and use its methods.
Each title class has a constructor that takes a RequestManager
object as parameter. This object is used to make requests to the API
and contains a HttpClient
object that can be configured. Also, you can attach a Listener
object to the RequestManager
if you want to use events.
You can follow the example below:
public class Main {
public static void main(String[] args) {
// Create a new RequestManager Object
RequestManager request = new RequestManager();
// Create a new BlackOps3 Object
BlackOps3 bo3 = new BlackOps3(request);
// Handle your method using BlackOps3 Object methods...
bo3.getLeaderboard(Platform.PLAYSTATION, TimeFrame.ALLTIME, Gamemode.CAREER, GameType.HARDCORE, 1);
}
}
public class Main {
public static void main(String[] args) {
// Create a new RequestManager Object
RequestManager request = new RequestManager();
// Create a new User Object
User user = new User(request);
// Handle your method using User Object methods...
user.searchPlayer("iZy", Platform.PLAYSTATION, ssoToken);
}
}
This wrapper allows you to interact between a request step using some event. The RequestManager
Class has constructors that allow you to pass a Listener
object instance as parameter.
All you have to do is to make a ListenerHandler class that extends Listener
class and override the methods you want to use.
Consider that to be listened, you have to annotate your method with @EventHandler
annotation.
EventHandler annotation has a priority
parameter which is an enum of type Priority
and has 3 values : LOW
, NORMAL
and HIGH
. The default value is NORMAL
. Use this if you have more than one Listener or event method.
public class MyListener extends Listener {
@EventHandler(priority = ListenerPriority.NORMAL)
public void onPreRequestLowPriority(PreRequestEvent event) {
System.out.println(event.getEventName() + " : This is an event!");
}
}
public class Main {
public static void main(String[] args) {
// Create a new RequestManager Object
RequestManager request = new RequestManager(new MyListener());
// ...
}
}
repositories {
mavenCentral()
}
dependencies {
implementation('io.github.izycorp:codapi:1.0.3')
}
<dependency>
<groupId>io.github.izycorp</groupId>
<artifactId>codapi</artifactId>
<version>1.0.3</version>
</dependency>