*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

DataStoreEntry

數據儲存中的鑰匙值入口。

  • 資源路徑
  • /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries
  • /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/scopes/{scope_id}/entries

特性

pathstring

數據儲存入口的資源路徑。

格式:

  • universes/{universe_id}/data-stores/{data_store_id}/entries/{data_store_entry_id}
  • universes/{universe_id}/data-stores/{data_store_id}/scopes/{data_store_scope_id}/entries/{data_store_entry_id}.
createTimestring
僅限輸出

資料儲存入口創建時的時戳。. 此字串的格式為 Timestamp

revisionIdstring
不可改變
僅限輸出

數據儲存入口的修訂ID。

當資料儲存入口以任何方式變更時,都會提交新版本。

格式是任意字串。例如:「foo」.

revisionCreateTimestring
僅限輸出

修訂創建時的時戳。. 此字串的格式為 Timestamp

stateEnum<string>
僅限輸出

數據儲存入口狀態。

可能的值:

| 值 | 說明 | | --- | --- | | STATE_UNSPECIFIED | 預設值。如果狀態被忽略,這個值將被使用。| | 啟用 | 新建的數據儲存入口的預設狀態。| | 刪除 | 數據儲存入口被標記為已刪除。在未來的某個時間點,它將永久刪除。|. 可能的值:

etagstring

此檢查總和由服務器根據其他欄位的值計算,可以在更新和刪除請求(以及可能在某些自訂方法上)上傳送,以確保客戶端在進行前擁有最新值。.

valueJSON value

入口的值。.

JSON 值可為「null」、「boolean」、「string」、「number」、「array」或「object」。

idstring
僅限輸出

入口的資源ID。

這與資源路徑的最後一個區段相匹配,只提供便利。.

usersarray<string>

與入口相關的使用者。.

attributesobject

與入口相關的任意一組特性。.

基本網址

https://apis.roblox.com
DataStoreEntry資源

{
"path": "universes/123/data-stores/some-data-store/entries/some-data-store-entry",
"createTime": "2023-07-05T12:34:56Z",
"revisionId": "string",
"revisionCreateTime": "2023-07-05T12:34:56Z",
"state": "STATE_UNSPECIFIED",
"etag": "string",
"value": "JSON value",
"id": "string",
"users": [
"string"
],
"attributes": "object"
}

DataStoreEntry

列出數據儲存入口記錄
Beta

GET /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries

返回資料儲存庫的一個列表入口。

只有 pathid 欄位被填滿;使用 GetDataStoreEntry 來取回其他欄位。

指定通配符範圍(-)來列出所有範圍的入口。

範圍
universe-datastores.objects:list
請求路徑參數
universe_idstring
需要

宇宙ID。.

data_store_idstring
需要

數據儲存ID。.

查詢參數
maxPageSizenumber

要返回的資料儲存入口最大數量。服務可能會返回少於此值。如果未指定,最多返回 10 個資料儲存入口。最大值為 256,高於 256 的值設為 256。.

pageTokenstring

從以前的呼叫中收到的頁面代幣,用於取回後續頁面。

當頁面分頁時,所有其他參數提供給後續呼叫的頁面代幣必須與提供頁面代幣的呼叫匹配。.

filterstring

此欄位可設為過濾返回的資源。

田支持非常小的CEL子集:

  • 只有 id 欄位被支援。
  • 只有 startsWith 功能可用;沒有其他運作者或預製件支持。

範例過濾器:id.startsWith("foo").

showDeletedboolean

如果真的,標為待刪除的資源將包含在結果中。.

回應

父集合中的數據儲存入口列表。

dataStoreEntriesarray<DataStoreEntry>

指定的數據儲存或數據儲存範圍的數據儲存入口。.

nextPageTokenstring

您可以將其作為pageToken參數發送到回收下一頁的代幣。如果此欄位被忽略,就沒有後續頁面。.

GET /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries

curl -L -X GET 'https://apis.roblox.com/cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries?maxPageSize=10&pageToken={string}&filter={string}&showDeleted={boolean}' \
-H 'x-api-key: {your-api-key}'
回應

{
"dataStoreEntries": [
{
"path": "universes/123/data-stores/some-data-store/entries/some-data-store-entry",
"createTime": "2023-07-05T12:34:56Z",
"revisionId": "string",
"revisionCreateTime": "2023-07-05T12:34:56Z",
"state": "STATE_UNSPECIFIED",
"etag": "string",
"value": "JSON value",
"id": "string",
"users": [
"string"
],
"attributes": "object"
}
],
"nextPageToken": "string"
}

DataStoreEntry

創建資料儲存入口
Beta

POST /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries

創建具有提供的ID和值的記錄。

如果入口存在,返回 400 個不良請求。

範圍
universe-datastores.objects:create
請求路徑參數
universe_idstring
需要

宇宙ID。.

data_store_idstring
需要

數據儲存ID。.

查詢參數
idstring

用於資料儲存入口的ID,將成為資料儲存入口資源路徑的最後組成部分。

此值應為 1-50 個字元字串。我們強烈建議只使用小寫字母、數字和撇號。.

請求主體DataStoreEntry
POST /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries

curl -L -X POST 'https://apis.roblox.com/cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries?id=my-entry' \
-H 'x-api-key: {your-api-key}' \
-H 'Content-Type: application/json' \
--data '{
"etag": "string",
"value": "JSON value",
"users": [
"string"
],
"attributes": "object"
}'
回應

{
"path": "universes/123/data-stores/some-data-store/entries/some-data-store-entry",
"createTime": "2023-07-05T12:34:56Z",
"revisionId": "string",
"revisionCreateTime": "2023-07-05T12:34:56Z",
"state": "STATE_UNSPECIFIED",
"etag": "string",
"value": "JSON value",
"id": "string",
"users": [
"string"
],
"attributes": "object"
}

DataStoreEntry

取得資料儲存入口
Beta

GET /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}

取得指定的輸入。

要在特定版本中獲得入口,請在路徑末尾添加 @<revisionId>

例如,要在修訂 ID my-entry 獲得 08DC3D3F43F9FCC1.0000000001.08DC3D3F43F9FCC1.01,請使用路徑 /v2/universes/1234/data-stores/5678/entries/my-entry@08DC3D3F43F9FCC1.0000000001.08DC3D3F43F9FCC1.01

如果您的入口ID包含一個或多個@字符,且您想要獲得最新版本而不是特定版本,請在路徑末端添加特殊版本ID@latest以獲得最新版本。否則,最後 @ 之後的入口ID段將被解釋為修訂ID。

例如,要取得 my-entry 最新版本,請使用路徑 /v2/universes/1234/data-stores/5678/entries/my@entry@latest

要獲得在特定時間為現有的入口,請在路徑末尾添加 @latest:<timestamp> ,其中 <timestamp> 為 RFC-3339 格式。指定的時戳必須是 Unix 時代(1/1/1970)之後,並且不超過十分鐘的未來。

例如,要取得 12/2/2024 在 06:00 UTC 時的 my-entry 版本,請使用路徑 /v2/universes/1234/data-stores/5678/entries/my-entry@latest:2024-12-02T06:00:00Z

範圍
universe-datastores.objects:read
請求路徑參數
universe_idstring
需要

宇宙ID。.

data_store_idstring
需要

數據儲存ID。.

entry_idstring
需要

入口ID。.

GET /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}

curl -L -X GET 'https://apis.roblox.com/cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}' \
-H 'x-api-key: {your-api-key}'
回應

{
"path": "universes/123/data-stores/some-data-store/entries/some-data-store-entry",
"createTime": "2023-07-05T12:34:56Z",
"revisionId": "string",
"revisionCreateTime": "2023-07-05T12:34:56Z",
"state": "STATE_UNSPECIFIED",
"etag": "string",
"value": "JSON value",
"id": "string",
"users": [
"string"
],
"attributes": "object"
}

DataStoreEntry

刪除數據儲存入口
Beta

DELETE /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}

標記指定入口以進行刪除。

記錄不會立即刪除;相反,state字段將設為DELETED。永久刪除發生在30天後。

成功時,返回 200 好。如果入口不存在,返回 404 未找到。

範圍
universe-datastores.objects:delete
請求路徑參數
universe_idstring
需要

宇宙ID。.

data_store_idstring
需要

數據儲存ID。.

entry_idstring
需要

入口ID。.

DELETE /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}

curl -L -X DELETE 'https://apis.roblox.com/cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}' \
-H 'x-api-key: {your-api-key}'

DataStoreEntry

更新資料儲存入口
Beta

PATCH /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}

更新入口的值、特性和使用者。

更新入口的特定修訂是 不支持 。如果您在路徑中指定版本ID,且allow_missingtrue,則更新請求會創建一個新記錄,其中包含@<revisionId>補充字串作為鑰匙的一部分。

部分更新是 不支持 。如果在更新值時沒有提供特性或使用者,它們將被清除。必須在更新入口時提供值。

範圍
universe-datastores.objects:update
請求路徑參數
universe_idstring
需要

宇宙ID。.

data_store_idstring
需要

數據儲存ID。.

entry_idstring
需要

入口ID。.

查詢參數
allowMissingboolean

如果設為真,且資料儲存入口未找到,會創建一個資料儲存入口。.

請求主體DataStoreEntry
PATCH /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}

curl -L -X PATCH 'https://apis.roblox.com/cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}?allowMissing={boolean}' \
-H 'x-api-key: {your-api-key}' \
-H 'Content-Type: application/json' \
--data '{
"etag": "string",
"value": "JSON value",
"users": [
"string"
],
"attributes": "object"
}'
回應

{
"path": "universes/123/data-stores/some-data-store/entries/some-data-store-entry",
"createTime": "2023-07-05T12:34:56Z",
"revisionId": "string",
"revisionCreateTime": "2023-07-05T12:34:56Z",
"state": "STATE_UNSPECIFIED",
"etag": "string",
"value": "JSON value",
"id": "string",
"users": [
"string"
],
"attributes": "object"
}

DataStoreEntry

增量資料儲存入口
Beta

POST /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}:increment

增加指定入口的值。既有值和增量金額都必須是整數。

如果入口不存在,會創建一個具有指定值的入口。

增加入口的特定修改不支持 不支持 。如果在路徑中指定版本 ID,增量請求將創建一個新的入口,其中包含 @<revisionId> suffix 作為鑰匙的一部分。

已知問題:值可能超出有效範圍的值。當發生這種情況時,返回的值將被限制在有效範圍內,但後端可能會保留原始值。這種行為是為了保持與舊版本的相容性,但可能在此 API 的未來版本中發生變更。

範圍
universe-datastores.objects:createuniverse-datastores.objects:update
請求路徑參數
universe_idstring
需要

宇宙ID。.

data_store_idstring
需要

數據儲存ID。.

entry_idstring
需要

入口ID。.

請求主體
amountnumber

增加入口值的數量。既有值和增量數量都必須是整數。.

usersarray<string>

與入口相關的使用者。

如果未提供,現有使用者ID將被清除。.

attributesobject

與入口相關的任意一組特性。

如果未提供,現有特性將被清除。.

POST /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}:increment

curl -L -X POST 'https://apis.roblox.com/cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}:increment' \
-H 'x-api-key: {your-api-key}' \
-H 'Content-Type: application/json' \
--data '{
"amount": "number",
"users": [
"string"
],
"attributes": "object"
}'
回應

{
"path": "universes/123/data-stores/some-data-store/entries/some-data-store-entry",
"createTime": "2023-07-05T12:34:56Z",
"revisionId": "string",
"revisionCreateTime": "2023-07-05T12:34:56Z",
"state": "STATE_UNSPECIFIED",
"etag": "string",
"value": "JSON value",
"id": "string",
"users": [
"string"
],
"attributes": "object"
}

DataStoreEntry

列出數據儲存入口修改
Beta

GET /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}:listRevisions

列出數據儲存入口的修訂。

此方法返回部分數據儲存入口。

特別是,只有 path , id , createTime , revisionCreateTime , revisionId , etagstate 欄位被填滿。兩個 pathid 字段都會有一個 @<version> 後綴。

為了在版本中獲得完整輸入,您可以使用提供的 path 字段與 GetDataStoreEntry 方法,即 GET /v1/universes/1234/data-stores/5678/entries/my-entry@<version>

範圍
universe-datastores.versions:list
請求路徑參數
universe_idstring
需要

宇宙ID。.

data_store_idstring
需要

數據儲存ID。.

entry_idstring
需要

入口ID。.

查詢參數
maxPageSizenumber

每頁返回的最大修改數量。

服務可能會返回少於最大數量的修訂。如果未指定,最多只返回 10 次修改。最大值為 100 個值,更高值設為 100。.

pageTokenstring

從以前的呼叫中收到的頁面代幣,用於取回後續頁面。

當頁面分頁時,所有其他參數提供給後續呼叫的頁面代幣必須與提供頁面代幣的呼叫匹配。.

filterstring

支持以下子集的 CEL:

  • 只有 && , <=>= 操作符被支持。
  • 只有 revision_create_time 欄位被支援。

例如:

"revision_create_time >= 2000-01-01T00:00:00Z && revision_create_time <= 2001-01-01T00:00:00Z".

回應

數據儲存入口的修訂列表。

nextPageTokenstring

您發送到下一頁作為 pageToken 參數的代幣。如果此欄位被忽略,就沒有後續頁面。.

GET /cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}:listRevisions

curl -L -X GET 'https://apis.roblox.com/cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}:listRevisions?maxPageSize=10&pageToken={string}&filter={string}' \
-H 'x-api-key: {your-api-key}'
回應

{
"dataStoreEntries": [
{
"path": "universes/123/data-stores/some-data-store/entries/some-data-store-entry",
"createTime": "2023-07-05T12:34:56Z",
"revisionId": "string",
"revisionCreateTime": "2023-07-05T12:34:56Z",
"state": "STATE_UNSPECIFIED",
"etag": "string",
"value": "JSON value",
"id": "string",
"users": [
"string"
],
"attributes": "object"
}
],
"nextPageToken": "string"
}