An open API service indexing awesome lists of open source software.

https://github.com/shinigami92/satisfactory-server-api-client

Universal Satisfactory Server API client for JavaScript
https://github.com/shinigami92/satisfactory-server-api-client

api-client api-wrapper coffeestain dedicated-server esm fetch fetch-api ky satisfactory typescript

Last synced: 3 months ago
JSON representation

Universal Satisfactory Server API client for JavaScript

Awesome Lists containing this project

README

        

# Satisfactory Server API Client

![Satisfactory](https://raw.githubusercontent.com/Shinigami92/satisfactory-server-api-client/main/.github/logo.png "Satisfactory logo")

[![npm version](https://badgen.net/npm/v/satisfactory-server-api-client)](https://www.npmjs.com/package/satisfactory-server-api-client)
[![npm downloads](https://badgen.net/npm/dm/satisfactory-server-api-client)](https://www.npmjs.com/package/satisfactory-server-api-client)

This is an unofficial HTTP API wrapper for Satisfactory Dedicated Server API.

The project is in an early state and will not document changelogs until v1.0.0 release.
If you want a specific API Endpoint prioritized, please open an issue.

Official API Docs can be found at `Steam/steamapps/common/Satisfactory/CommunityResources/DedicatedServerAPIDocs.md` or at [satisfactory.wiki.gg HTTPS API](https://satisfactory.wiki.gg/wiki/Dedicated_servers/HTTPS_API).

You can obtain an `accessToken` by executing `server.GenerateAPIToken` in your server console.

## Usage

```ts
import { createClient } from "satisfactory-server-api-client";

// If your dedicated server uses a self-signed certificate (generated by default),
// you can disable SSL verification by configuring the following environment variable.
//process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

const client = createClient({
accessToken: "",
});

client.v1
.HealthCheck({
data: {
clientCustomData: "",
},
})
.then((response) => {
console.log("HealthCheck Response:", response);
});

client.v1.VerifyAuthenticationToken().then(() => {
// response will be an empty string if valid
});

client.v1.QueryServerState().then((response) => {
console.log("QueryServerState Response:", response);
});

client.v1.GetServerOptions().then((response) => {
console.log("GetServerOptions Response:", response);
});

client.v1.GetAdvancedGameSettings().then((response) => {
console.log("GetAdvancedGameSettings Response:", response);
});

client.v1
.PasswordlessLogin({
data: {
minimumPrivilegeLevel: PrivilegeLevel.NotAuthenticated,
},
})
.then((response) => {
console.log("PasswordlessLogin Response:", response);
});

client.v1
.PasswordLogin({
data: {
minimumPrivilegeLevel: PrivilegeLevel.NotAuthenticated,
password: "your-password",
},
})
.then((response) => {
console.log("PasswordLogin Response:", response);
});

client.v1
.ApplyAdvancedGameSettings({
data: {
appliedAdvancedGameSettings: {
"FG.GameRules.NoPower": "False",
},
},
})
.then(() => {
// response will be an empty string if valid
});

client.v1
.ClaimServer({
data: {
serverName: "your-server",
adminPassword: "your-password",
},
})
.then((response) => {
console.log("ClaimServer Response:", response);
});

client.v1
.RenameServer({
data: {
serverName: "Shinigami-PC localhost",
},
})
.then(() => {
// response will be an empty string if valid
});

client.v1.EnumerateSessions().then((response) => {
console.log("EnumerateSessions Response:", response);
});
```

## See Also

- [wolveix/satisfactory-server](https://github.com/wolveix/satisfactory-server) - A Docker image for running a Satisfactory Dedicated Server.
- [satisfactory-server-prometheus-exporter](https://github.com/Shinigami92/satisfactory-server-prometheus-exporter) - A Prometheus Exporter for Satisfactory Dedicated Server.