Accessing the Fortnite store with Fortnite Tracker API

Fortnite Tracker is a third-party service that creates an API endpoint for the Fortnite game. Here is a guide on getting your player stats, however in this post I will show how to access the Fortnite store with PHP through Fortnite Tracker API.

The first step like last time is to call the API and save it into a JSON file, this can be done like so with the use of Curl and fwrite

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.fortnitetracker.com/v1/store");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'TRN-Api-Key: *API*KEY*HERE*'
));
$response = curl_exec($ch);
curl_close($ch);
$fp = fopen("stats.json", "w");
fwrite($fp, $response);
fclose($fp);

Remember to add your Fortnite Tracker API key in!

The easiest way to check if the API call worked is to run the following code, which will loop through the data and output the image, item name, rarity and vbucks price in a formatted manner.

$response = json_decode(file_get_contents('stats.json'), true);
foreach ($response as $val) {
    $image = $val['imageUrl'];
    $item = $val['name'];
    $rarity = $val['rarity'];
    $vbucks = $val['vBucks'];
    echo "<img src='$image' width='120px' height='120px'> <b>$item</b> | Rarity: $rarity vBucks: $vbucks<br>";
}
fortnite tracker store api
The output

You can see from the above code how each of the objects was accessed. If you wanted to store the values in a database instead of outputting the data you would insert using the variables.

Below is a spoiler of the raw Fortnite Tracker API call and yes it only has 11 items at this time.

See the individual comparison images
[
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/A79B1197_large.png",
    "manifestId": 1197,
    "name": "Spectral Axe",
    "rarity": "Sturdy",
    "storeCategory": "BRDailyStorefront",
    "vBucks": 800
  },
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/A23D5597_large.png",
    "manifestId": 5597,
    "name": "Pumpernickel",
    "rarity": "Sturdy",
    "storeCategory": "BRDailyStorefront",
    "vBucks": 500
  },
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/AC746010_large.png",
    "manifestId": 6010,
    "name": "Armadillo",
    "rarity": "Handmade",
    "storeCategory": "BRDailyStorefront",
    "vBucks": 800
  },
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/FEAD5526_large.png",
    "manifestId": 5526,
    "name": "Libre",
    "rarity": "Sturdy",
    "storeCategory": "BRDailyStorefront",
    "vBucks": 800
  },
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/9EC24775_large.png",
    "manifestId": 4775,
    "name": "Kiss Kiss",
    "rarity": "Sturdy",
    "storeCategory": "BRDailyStorefront",
    "vBucks": 500
  },
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/EB1A6012_large.png",
    "manifestId": 6012,
    "name": "Scorpion",
    "rarity": "Handmade",
    "storeCategory": "BRDailyStorefront",
    "vBucks": 800
  },
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/7C4F6123_large.png",
    "manifestId": 6123,
    "name": "Shadow Puppet",
    "rarity": "Quality",
    "storeCategory": "BRWeeklyStorefront",
    "vBucks": 1200
  },
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/90826111_large.png",
    "manifestId": 6111,
    "name": "Wild Card",
    "rarity": "Fine",
    "storeCategory": "BRWeeklyStorefront",
    "vBucks": 2000
  },
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/F3686115_large.png",
    "manifestId": 6115,
    "name": "Hacivat",
    "rarity": "Quality",
    "storeCategory": "BRWeeklyStorefront",
    "vBucks": 1500
  },
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/5F0D6127_large.png",
    "manifestId": 6127,
    "name": "Tree Splitter",
    "rarity": "Handmade",
    "storeCategory": "BRWeeklyStorefront",
    "vBucks": 500
  },
  {
    "imageUrl": "https://cdn.thetrackernetwork.com/cdn/fortnite/BBCB6124_large.png",
    "manifestId": 6124,
    "name": "Safecracker",
    "rarity": "Sturdy",
    "storeCategory": "BRWeeklyStorefront",
    "vBucks": 800
  }
]