Key/Value Store

This service provides a flexible, runtime-accessible key/value store for persisting arbitrary data. It can be used by both game clients and servers to cache, retrieve, and manage state and user data.

Read KVStore data

post

Read KVStore data for the specified keys and from the specified stores. If a World ID or Launch Context ID header are supplied, the respective Project ID header must also be supplied.

Data can be read from either the client or server store by both the user and Unreal server or service accounts. Client store data can only be written by the user whose store it is but can be read by the user and an Unreal server or service account. The server store can only be written by the Unreal server or service account but may be read by both the user and the server.

Authorizations
Header parameters
x-m2-organization-idstringRequired

The ID of an organization

x-m2-project-idstringOptional

The ID of a project

x-m2-launch-context-idstringOptional

The ID of a launch context

x-m2-world-idstringOptional

The ID of a world

Body

Request to read from a KV Store for a given user, store and key.

idstringRequired

The ID of the user who's store is being accessed

storeany ofRequired

Client or Server KV Store

string · enumOptionalPossible values:
or
string · enumOptionalPossible values:
keystringRequired

The key of the value of interest

Responses
200
The response for a KV Store read request.
application/json
post
POST /api/kvstore/read/ HTTP/1.1
Host: your-organization-id.m2worlds.io
Authorization: Bearer YOUR_SECRET_TOKEN
x-m2-organization-id: text
Content-Type: application/json
Accept: */*
Content-Length: 52

[
  {
    "id": "text",
    "store": "kvstoreClient",
    "key": "text"
  }
]
[
  {
    "status": "ok",
    "id": "text",
    "store": "kvstoreClient",
    "object": {
      "key": "text",
      "data": null
    }
  }
]

List KVStore keys

get

List all keys for the specified store. If a World ID header is supplied, the Project ID header must also be supplied. Keys can be read from either the client or server store by both the user and the Unreal server.

Authorizations
Query parameters
storeany ofRequired

Client or Server KV Store

string · enumOptionalPossible values:
or
string · enumOptionalPossible values:
Header parameters
x-m2-organization-idstringRequired

The ID of an organization

x-m2-project-idstringOptional

The ID of a project

x-m2-world-idstringOptional

The ID of a world

Responses
200
The response for a KV Store list keys request.
application/json
get
GET /api/kvstore/keys/ HTTP/1.1
Host: your-organization-id.m2worlds.io
Authorization: Bearer YOUR_SECRET_TOKEN
x-m2-organization-id: text
Accept: */*
{
  "keys": [
    "text"
  ]
}

Delete specific KVStore entries

post

Delete entries for the specified keys from the specified store for the current user. If a World ID header is supplied, the Project ID header must also be supplied. Keys can be deleted from either the client or server store. This operation is non-recursive and only affects the specified scope level.

Authorizations
Header parameters
x-m2-organization-idstringRequired

The ID of an organization

x-m2-project-idstringOptional

The ID of a project

x-m2-world-idstringOptional

The ID of a world

Body

The request body for deleting specific keys from a KV Store.

keystringRequired

The key to delete from the store

storeany ofRequired

Client or Server KV Store

string · enumOptionalPossible values:
or
string · enumOptionalPossible values:
Responses
204
Indicates the KV Store was successfully cleared.
application/json
Responseobject

Indicates the KV Store was successfully cleared.

post
POST /api/kvstore/keys/delete/ HTTP/1.1
Host: your-organization-id.m2worlds.io
Authorization: Bearer YOUR_SECRET_TOKEN
x-m2-organization-id: text
Content-Type: application/json
Accept: */*
Content-Length: 40

[
  {
    "key": "text",
    "store": "kvstoreClient"
  }
]
{}

Upsert KVStore data

post

Upsert KVStore data for the specified keys and from the specified stores. If a World ID or Launch Context ID header are supplied, the respective Project ID header must also be supplied.

Any existing data under the given keys will be overwritten.

Data can be read from either the client or server store by both the user and Unreal server or service accounts. Client store data can only be written by the user who's store it is but can be read by the user and an Unreal server or service account. The server store can only be written by the Unreal server or service account but may be read by both the user and the server.

Authorizations
Header parameters
x-m2-organization-idstringRequired

The ID of an organization

x-m2-project-idstringOptional

The ID of a project

x-m2-launch-context-idstringOptional

The ID of a launch context

x-m2-world-idstringOptional

The ID of a world

Body

The request body for a KV Store upsert request.

idstringRequired

The ID of the user who's store is being accessed

storeany ofRequired

Client or Server KV Store

string · enumOptionalPossible values:
or
string · enumOptionalPossible values:
keystringRequired

The key of the value of interest

dataanyRequired

The data to upsert against the passed key in the specified store

Responses
200
The response for a KV Store upsert request. Object contains the upserted data.
application/json
post
POST /api/kvstore/upsert/ HTTP/1.1
Host: your-organization-id.m2worlds.io
Authorization: Bearer YOUR_SECRET_TOKEN
x-m2-organization-id: text
Content-Type: application/json
Accept: */*
Content-Length: 64

[
  {
    "id": "text",
    "store": "kvstoreClient",
    "key": "text",
    "data": null
  }
]
[
  {
    "id": "text",
    "store": "kvstoreClient",
    "object": {
      "key": "text",
      "data": null
    }
  }
]

Clear KVStore data

post

Delete all KVStore data except for the specified keys. If a World ID or Launch Context ID header are supplied, the respective Project ID header must also be supplied.

Both the client and server data will be cleared at the given level only. i.e. clearing the Organization store will not have an impact on any child Projects, Launch Contexts, nor Worlds.

Authorizations
Header parameters
x-m2-organization-idstringRequired

The ID of an organization

x-m2-project-idstringOptional

The ID of a project

x-m2-launch-context-idstringOptional

The ID of a launch context

x-m2-world-idstringOptional

The ID of a world

Body

The request body for a KV Store delete request.

keysToIgnorestring[]Optional

An array of keys to ignore when clearing the store

storeany ofRequired

Client or Server KV Store

string · enumOptionalPossible values:
or
string · enumOptionalPossible values:
Responses
204
Indicates the KV Store was successfully cleared.
application/json
Responseobject

Indicates the KV Store was successfully cleared.

post
POST /api/kvstore/delete/ HTTP/1.1
Host: your-organization-id.m2worlds.io
Authorization: Bearer YOUR_SECRET_TOKEN
x-m2-organization-id: text
Content-Type: application/json
Accept: */*
Content-Length: 49

{
  "keysToIgnore": [
    "text"
  ],
  "store": "kvstoreClient"
}
{}

Last updated

Was this helpful?