How to Race

Quickstart

How does it work?

The race has five tiers of competition. You make a racer application that implements a REST API, and we test it out on our racetrack (really just a REST client that calls your application's API).

Tier 1: One Lap

The first tier is to complete one lap around the track. This means our code will send aPOST requestto your

/races
resource containing a token, which your applicaton needs to remember. Your application should return a raceId that we will use for the remainder of this race.

We will then send aPOST requestto your

/races/{id}/laps
resource containing a new token. For tier one, you don't need to do anything with the new token; that's going to matter for the next tier. Your application needs to respond with the token you received when this race started.

If it all works, our race will record the time it took for the whole process to complete. That's your score for Tier One.

Tier 2: One Hundred Laps

If your racer application successfully completes Tier 1, we will immediately attempt to run one hundred laps as fast as your racer can complete them. This uses the same two Racer API operations that you implemented for Tier 1. The only new requirement is for your

/races/{id}/laps
operation to remember each new token it receives, so that it can return it the next time.

Your Tier 2 score is the time it takes your racer to complete the initial

POST
to
/races
plus all 100 POSTs to
/races/{id}/laps
.

Tier 3: Temperatures

If your racer completes 100 laps, you qualify for Tier 3, and your racer must also implement the

/temperatures
resource. This is your first step in the journey to the One Billion Row Challenge!

We will send a

POST
request to your racer with an array of temperature measurements collected at weather stations all over the world. Your racer application is expected to respond with the average temperature at each weather station. The stations have to be alphabetized, and the average temperatures have to be rounded to five decimal places like this:
19.03471

For Tier 3, you will receive 1000 measurements, and your score is the time it takes for your racer to respond with accurate results.

Tier 4: One Million Rows

If your racer succeeds in Tier 3, we will send another

POST
request to the same
/temperatures
resource, this time with 1,000,000 temperature measurements. This might require you to pay more attention to the algorithm you choose, and your racer"s RAM requirements!

Tier 5: The One Billion Row Challenge

If your racer succeeds in Tier 4, you qualify for Tier 5, the One Billion Row Challenge. Congratulations!

We will

POST
1,000,000,000 temperature measurements to your racer. This request carries a
Content-Encoding
header to indicate that the request uses gzip compression! This is the highest level of the Anypoint Race, and we will publicly announce everyone who achieves Tier 5 in Season 3!

Make a Racer API

In order to compete, you need to make a racer application that implements theRacer APIand is reachable from the public internet. You can use any language you want; we tested it using a MuleSoft application and deploying to CloudHub 2.0.

Use the Race API

To use the Anypoint Race API (portal), you need to have a client ID and client secret. You can get these by creating an Anypoint Platform account and requesting access on the API Portal. Use the Login link at the top right, and choose "Sign in with Anypoint Platform". If you don't have an account, or if you just want to create a new one, use the "Sign up" button all the way at the bottom.

Once you have an account, there will be a "Request Access" button at the top of the Anypoint Race API portal. Use that to get your client credentials.

You race by making HTTP requests to the Anypoint Race API. I recommend using a REST client such as Postman.

  1. Register a racerand save the
    racerId
    you get back. Your racer application will need to provide this racer ID while racing!
  2. Create an entryusing the endpoint of your Racer API
  3. Check the statusof your entry

Once the race is done, your results will post to the leaderboard! If you want to try again, delete your entry and you will be able to create a new one.

Check your Results

Each time you enter a race, you can see your performance using Check Racer Status (

GET /racers/{id}/entry
). You can also see how you‘re doing on the Anypoint Speedway Season 3 Leaderboard.

APIs

Racer API

You must create an application that implements theRacer APIand deploy it somewhere that it is reachable from the public internet.

This API has three operations:

Start a race

This operation should expect to receive a token, and save it somewhere to be used later in the Complete a lap operation. It should respond with a unique ID to be used for this race, and the racerId you received from the Race API

POST /register
operation.

Complete a lap

This operation should expect to receive a new token, and save it so that it can be returned in the next request to complete a lap. If this is the first lap, it should respond with the token received in the Start a race operation. Otherwise, it should respond with the token received in the last lap. It also needs to respond with the racerId from the Race API.

Compute average temperatures

This operation is used for Tiers III through V. It should expect to receive an array of temperature measurements, each with a

station
and a
temperature
. Your API must average the temperature measurements for each unique value of
station
and respond with an alphabetized array of JSON objects. Each object should provide the name of a station and it‘s temperature average, rounded to five decimal places, like
17.39015
.

At Tier III, you will receive 1000 measurements. At Tier IV, you will receive 1000000 measurements.

At Tier V, you will receive 1000000000 measurements, and the request will have a

Content-Encoding
header to indicate that the request body has been compressed. You will need to decompress the JSON in order to average the temperatures. This is a REST API variant of theOne Billion Row Challenge created byGunnar Morling!

Race API

You use theAnypoint Race APIto participate in the race. You authenticate with HTTP Basic Authentication, using the client ID and client secret you get when you request access on the Anypoint Race API Portal.

First, you need to register your racer with a display name and an email using the

POST /register
operation. The full URL is
https://api.anypointspeedway.com/race/register
.

Then, you can control your racer‘s entry using the

/entry
resource: