Cloud APIs
StandardDataStoresApi_V2
updateStandardDataStoreEntry

updateStandardDataStoreEntry

Updates an entry in a standard datastore.

Parameters

NameTypeDescription
universeIdIdentifierThe ID of the universe to update an entry in.
dataStorestringthe name of the datastore to update an entry in.
scope?stringThe optional scope of the dataStore.
entryIdstringThe ID (key / name) of the entry.
allowMissingbooleanIf set to true, and the data store entry is not found, a data store entry is created.
valueSchemaThe value (content) of the entry.
users?ArrayNonEmptyIfConstArray metadata containing the IDs of the users this entry is affiliated with.
attributes?Record<any, any>Key-Value Pairs metadata containing arbitrary data.

Example

type InventorySchema = { Iron?: number; Gold?: number; Copper?: number; Stone?: number; Wood?: number };
const {
  data,
  response: { body },
} = await StandardDataStoresApi_V2.updateStandardDataStoreEntry<InventorySchema>({
  universeId: 5097539509,
  dataStore: "InventoryStore",
  entryId: "users/453482811",
  value: { Iron: 50, Gold: 26 },
  users: [45348281],
}); 

Example Data

{
  path: "universes/5097539509/data-stores/InventoryStore/entries/users:453482811",
  createTime: 2024-07-22T19:02:27.811Z,
  revisionId: "08DCAA80D489FD52.0000000003.08DCAA8627CF76E1.01",
  revisionCreateTime: 2024-07-22T19:02:27.811Z,
  state: "ACTIVE",
  etag: "08DCAA80D489FD52.0000000003.08DCAA8627CF76E1.01",
  value: { Iron: 50, Gold: 26 },
  id: "users:453482811",
  users: ["users/45348281"],
  attributes: {},
} 

Endpoint

PATCH /v2/universes/{universe}/data-stores/{data-store}/entries/{entryId}
PATCH /v2/universes/{universe}/data-stores/{data-store}/scopes/{scope}/entries/{entryId}