Skip to content

Wraiyth/FNAPI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NuGet Discord

FNAPI - C# Fortnite API

An unofficial .NET API Wrapper for the Fortnite API (http://fortniteapi.com) Documentation is found below!

Installation

Our stable build is available from NuGet through the FNAPI metapackage:

Getting Started

Once you have added the NuGet Package to your Project, you will need to add the using FortniteAPI; to your class header. Then simply instance the FNAPI class with your API key, like so:

var API = new FNAPI("ENTER A VALID API KEY HERE");

Now you can easily make calls to the API.

GetCurrentVersion()

Returns the current Game Version.

var version = API.GetCurrentVersion();

GetUser()

The base user class FNUser contains the UID and Username of a user. If you already know a user's UID or Username, you can use the GetUser() method to return an FNUser object.

  • Username:
var user = API.GetUser<FNUser>("username");
  • UID:
var user = API.GetUser<FNUser>(new UID("uid"));

You can change the type returned by GetUser() too. For instance, if you were wanting to return a FNBRUser (say: to get the user's BR stats) - then you can simply pass that instead.

var user = API.GetUser<FNBRUser>("username");
var stats = await user.GetStatsAsync();

BR.Store.GetStoreAsync()

The current store is a breeze to get using GetStoreAsync(). This is an async method though, so it will need to be used with await.

var store = await API.BR.Store.GetStoreAsync();

This will return an FNBRStore object - which holds all the current in-store items. You can also use GetFeaturedStore() and GetDailyStore() on the FNBRStore to return the corresponding in-store items.

var daily = store.GetDailyStore();
var featured = store.GetFeaturedStore();

The FNBRStore also has the ability to get any upcoming items available but not yet in stores.

var upcoming = await API.BR.Store.GetUpcomingItemsAsync();

If you are looking for an item that isn't currently in-stores, you can search for it!

var item = await API.BR.Store.SearchAsync("ITEM NAME");

This will return an FNStoreItem which can be used to get more details on the item. For example, we can use it to get the occurrences of said item.

var searchItem = API.BR.Store.SearchAsync("ITEM NAME").First();
var item = await API.BR.Store.GetItemAsync(searchItem.ItemID);
var occurrences = await item.GetOccurrencesAsync();

BR.Challenges.GetChallengesAsync()

NOTE: This won't expose any unreleased challenges.

This will return a list of FNChallengeItem. Which holds information about the challenge's name, stars required and difficulty. You can check which the current week for challenges like so:

var challenges = API.BR.Challenges.GetChallengesAsync();

BR.Leaderboard.GetLeaderboardAsync()

In Battle Royale, there are Global Leaderboards. You can get these using the API, quick easily! Using GetLeaderboardAsync() will return a list of FNLeaderboardItem.

var leaderboard = await API.BR.Leaderboard.GetLeaderboardAsync();

This includes information about each leaderboard entry. However, from this, you can then use GetUser() to return a FNBRUser object based on the leaderboard entry - this can then be used to look up the players stats.

	var leaderboardItem = await API.BR.Leaderboard.GetLeaderboardAsync().First();
	var user = leaderboardItem.GetUser();
	var userStats = await user.GetStatsAsync();

BR.News.GetNewsAsync()

This returns a list of FNNewsItem. This holds the Title, Body and Image for the BR MOTD.

var news = await API.BR.News.GetNewsAsync();

STW.News.GetNewsAsync()

This returns a list of FNNewsItem. This holds the Title, Body and Image for the STW MOTD.

var news = await API.STW.News.GetNewsAsync();

GetStatusAsync()

Need to check whether servers are up and running? Simply use the GetStatusAsync() method.

var status = await API.GetStatusAsync();

GetCurrentWeek()

Returns the current Week.

var week = API.GetCurrentWeek();

Returns the current Season.

GetCurrentSeason()

var season = API.GetCurrentSeason();

Patchnotes.GetPatchnotesAsync()

Want the latest patchnotes? Use this simple call to get data from the Patchnotes. This includes: title,description, images and an ExternalLink to the patchnotes page.

var patchnotes = await API.Patchnotes.GetPatchnotesAsync();

About

A Fortnite API Wrapper in C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%