-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
Using the API is really easy, see for yourself:
First, you need to import the API into your project. You can do this either via TypeScript or via JavaScript or Node.js:
import {
// Settings and other Stuff
Configuration,
// Usable backends
PlayElements,
Blueprints,
// Models or Enums, if you need it
Tag,
Mod,
PublishState
} from 'battlefield6-api';const BF6 = require('battlefield6-api');
/*
// Settings and other Stuff
BF6.Configuration,
// Usable backends
BF6.PlayElements,
BF6.Blueprints,
// Models or Enums, if you need it
BF6.Tag,
BF6.Mod,
BF6.PublishState
*/To connect to the portal server, you need a valid session.
This must be set before the first operation is performed, otherwise you will get an SessionException:
Warning
SessionException [Error]: The request does not have valid authentication credentials for the operation.
Configuration.setSession('web-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');You can catch some Exceptions (see Status for more details) with an try/catch-Block:
try {
// Load all PlayElements without having set before Configuration.setSession
await PlayElements.list();
} catch(error: SessionException) {
console.error('YOU ARE NOT LOGGED IN!');
}
The actual abstraction layer for retrieving or sending data from the portal server.
⠀⠀
⠀⠀
⠀⠀
The actual abstraction layer for retrieving or sending data from the portal server.
⠀⠀
⠀⠀
⠀⠀


⠀⠀
Model data for simplified use of the data.
⠀⠀
⠀⠀
⠀⠀
⠀⠀
⠀⠀
⠀⠀
⠀⠀
⠀⠀
⠀⠀
⠀⠀
Static data and informations.
⠀⠀
⠀⠀
⠀⠀