REST-API
On this page
The ODIN Fleet REST-API allows you to interact with the ODIN Fleet platform programmatically. You can use the API to automate game server deployment and management, integrate ODIN Fleet into your CI/CD workflows, and more.
We have published the OpenAPI specification for the ODIN Fleet REST-API, which you can use to generate SDKs for various programming languages. We provide an SDK for Node.js, which you can use to interact with the ODIN Fleet REST-API.
Documentation
We offer a nice interface to learn more about data structures and available routes.
Authentication
In order to use the ODIN Fleet REST-API, you need to authenticate your requests. You can do this by providing an API key in the Authorization
header of your HTTP requests.
Authorization: Bearer YOUR_ACCESS_TOKEN
Sign in to the ODIN Fleet dashboard and follow these simple steps to obtain your access token:
- Sign in to our dashboard.
- Choose an app or create one
- Go to the settings of the app
- Click on the API-Key section
- Copy the access token and use it in your requests
Open API Generator
We provide an OpenAPI specification file that you can use to generate an SDK for your preferred programming language. The generated SDK will allow you to interact with the ODIN Fleet REST-API programmatically.
However, there are a few caveats to keep in mind when generating an SDK from the OpenAPI specification file:
- Bearer Authorization does not work (although it is defined in the OpenAPI specification file and the generator should implement it)
- The generated SDK may not be easy to use as you may need to create request objects all the time (instead of just using function parameters)
It depends on the generator, but we experienced these issues with quite a lot of generated code.
To circumvent these issues, we provide an SDK for Node.js that is specifically designed to interact with the ODIN Fleet REST-API and will provide a C# SDK soon. We typically create one entry class that sets up the correct settings and wraps the API calls in a more user-friendly way.
Here is an example of the Node.js SDK that we provide (left out comments and docs to keep it short):
export class FleetApiClient {
private _client: FleetApi;
constructor(accessToken: string, protected configuration = DefaultConfig) {
// This needs to be set as the OpenAPI Generator doesn't support the Authorization header
var headers = {
Authorization: `Bearer ${accessToken}`,
}
// Setup the configuration
var configParams = {
basePath: configuration.basePath,
headers: {...configuration.headers, ...headers},
fetchApi: configuration.fetchApi,
middleware: configuration.middleware,
username: configuration.username,
password: configuration.password,
apiKey: configuration.apiKey,
accessToken: configuration.accessToken,
credentials: configuration.credentials,
} as ConfigurationParameters;
var config = new Configuration(configParams);
this._client = new FleetApi(config);
}
get client(): FleetApi {
return this._client;
}
// Wrap functions of the underlying SDK but in a more friendly way
async createApp(name: string): Promise<App> {
return this.client.createApp({createAppRequest: {name}});
}
async getApps(): Promise<Array<App>> {
return this.client.getApps();
}
//....
}