4.0.4 • Published 2 years ago

fpl-api v4.0.4

Weekly downloads
23
License
MIT
Repository
github
Last release
2 years ago

FPL API

Use the public endpoints from the official api from https://fantasy.premierleague.com. Return values are typed using Typescript and kept up to date as good as possible - some variance should be expected, but it is 95% accurate. Private endpoints that require a session are not implemented yet, but hopefully they will be soon.

This can be used in the browser and with node.js.

Installation

$ npm install fpl-api

Usage

import FplApi from 'fpl-api'

You can use fpl-api in the browser by using a module bundler like webpack, rollup, etc.

Methods

fetchBootstrap

General data such as players, teams, gameweeks, etc.

import { fetchBootstrap } from 'fpl-api'

const data = await fetchBootstrap()

fetchElementSummary

Data for a player.

import { fetchElementSummary } from 'fpl-api'

const playerId = 1
const data = await fetchElementSummary(playerId)

fetchEntryEvent

Entry event data (picks, transfers, etc.).

paramdescriptiontypedefaultrequired
entryIdID of an entrynumber-true
eventIdID of a gameweeknumber-true
import { fetchEntryEvent } from 'fpl-api'

const entryId = 1
const eventId = 38
const data = await fetchEntryEvent(entryId, eventId)

fetchEventStatus

Current event status.

import { fetchEventStatus } from 'fpl-api'

const data = await fetchEventStatus()

fetchFixtures

All fixtures or fixtures in a specific gameweek.

paramdescriptiontypedefaultrequired
eventIdID of a gameweeknumberundefinedfalse
import { fetchFixtures } from 'fpl-api'

const data = await fetchFixtures()

fetchLive

Live data for a gameweek.

paramdescriptiontypedefaultrequired
eventIdID of a gameweeknumber-true
import { fetchLive } from 'fpl-api'

const eventId = 33
const data = await fetchLive(eventId)

fetchEntryHistory

Entry transfers etc.

paramdescriptiontypedefaultrequired
entryIdID of an entry teamnumber-true
import { fetchEntryHistory } from 'fpl-api'

const entryId = 1
const data = await fetchEntryHistory(entryId)

fetchEntry

Get an entry.

paramdescriptiontypedefaultrequired
entryIdID of an entry teamnumber-true
import { fetchEntry } from 'fpl-api'

const entryId = 1
const data = await fetchEntry(entryId)

fetchH2HMatches

Get an entry's matches from a H2H league.

paramdescriptiontypedefaultrequired
leagueIdID of a H2H leaguenumber-true
entryIdID of an entry teamnumber-true
pagePage numbernumber1true
import { fetchH2HMatches } from 'fpl-api'

const leagueId = 1
const entryId = 1
const data = await fetchH2HMatches(leagueId, entryId)

fetchH2HLeagueStandings

Get H2H league standings page.

paramdescriptiontypedefaultrequired
leagueIdID of a H2H leaguenumber-true
options.pageStandingsPage number for standingsnumber1true
options.pageNewEntriesPage number for new entriesnumber1true
import { fetchH2HLeagueStandings } from 'fpl-api'

const leagueId = 1
const data = await fetchH2HLeagueStandings(leagueId)

fetchClassicLeague

Get H2H league standings page.

paramdescriptiontypedefaultrequired
leagueIdID of a classic leaguenumber-true
options.pageStandingsPage number for standingsnumber1true
options.pageNewEntriesPage number for new entriesnumber1true
options.phasePhase to shownumber1true
import { fetchClassicLeague } from 'fpl-api'

const leagueId = 1
const data = await fetchClassicLeague(leagueId)
4.0.4

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago