标准数据存储

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

Datastores

https://apis.roblox.com/datastores
相对于基础 URL 的路径,下列端点是可用的。

列数据存储

GET /v1/universes/{universeId}/standard-datastores

参数

universeId number
Path
必填
cursor string
limit number
prefix string

请求

curl

curl --include --location --request GET "https://apis.roblox.com/datastores/v1/universes/3310576216/standard-datastores" \
--header "x-api-key: ${API_KEY}" \
--get \
-d "prefix=Player" \
-d "limit=5"

答复

200 - OK
返回: object
application/json

{
"datastores": [
{
"name": "PlayerInventory",
"createdTime": "2022-02-18T22:38:59.9244932Z"
},
{
"name": "PlayerExperience",
"createdTime": "2022-02-18T23:00:10.4773508Z"
},
{
"name": "PlayerWeapons",
"createdTime": "2022-02-18T23:00:22.3725681Z"
},
{
"name": "PlayerArmor",
"createdTime": "2022-02-18T22:59:33.8472882Z"
},
{
"name": "PlayerHP",
"createdTime": "2022-02-18T22:58:47.6904028Z"
}
],
"nextPageCursor": "..."
}
data array<object>
nextPageCursor string

必要权限

  • 列表资料库

Entries

https://apis.roblox.com/datastores
相对于基础 URL 的路径,下列端点是可用的。

列出结果

GET /v1/universes/{universeId}/standard-datastores/datastore/entries

参数

universeId number
Path
必填
datastoreName string
scope string
allScopes boolean
prefix string
cursor string
limit number

请求

curl

curl --include --location --request GET "https://apis.roblox.com/datastores/v1/universes/3310576216/standard-datastores/datastore/entries" \
--header "x-api-key: ${API_KEY}" \
--get \
-d "datastoreName=Coins" \
-d "prefix=" \
-d "limit=5"

答复

200 - OK
返回: object
application/json

{
"keys": [
{
"key": "269323"
}
],
"nextPageCursor": "eyJ2ZXJzaW9uIjoxLCJjdXJzb3IiOiIzIyJ9"
}
keys array<string>
nextPageCursor string

必要权限

  • 列出条目键

获取入口

GET /v1/universes/{universeId}/standard-datastores/datastore/entries/entry

参数

universeId number
Path
必填
datastoreName string
entryKey string
scope string

请求

curl

curl --include --location --request GET "https://apis.roblox.com/datastores/v1/universes/3310576216/standard-datastores/datastore/entries/entry" \
--header "x-api-key: ${API_KEY}" \
--get \
-d "datastoreName=Coins" \
-d "entryKey=269323"

答复

200 - OK
返回响应体内的用户内容。
返回: object
application/json

{
"content-md5": "zuYxEhwuySMvOi8CitXImw==",
"roblox-entry-version": "08D9E6A3F2188CFF.0000000001.08D9E6A3F2188CFF.01",
"roblox-entry-created-time": "2022-02-02T23:30:06.5388799+00:00",
"roblox-entry-version-created-time": "2022-02-02T23:30:06.5388799+00:00",
"roblox-entry-userids": [ 1, 2, 3 ]
}
roblox-entry-created-time string
last-modified string
roblox-entry-version string
roblox-entry-attributes string
roblox-entry-userids array<number>
content-md5 string

必要权限

  • 读取条目

设置入口

POST /v1/universes/{universeId}/standard-datastores/datastore/entries/entry

参数

universeId number
Path
必填
datastoreName string
entryKey string
matchVersion string
exclusiveCreate boolean
scope string
roblox-entry-attributes string
Header
roblox-entry-userids string
Header
content-md5 string
Header

请求

curl

curl --include --location --request POST "https://apis.roblox.com/datastores/v1/universes/3310576216/standard-datastores/datastore/entries/entry?datastoreName=Coins&entryKey=269323" \
--header "x-api-key: ${API_KEY}" \
--header "content-md5: IGPBYI1uC6+AJJxC4r5YBA==" \
--header "content-type: application/json" \
--header "roblox-entry-userids: [269323]" \
--header "roblox-entry-attributes: {}" \
--d "value"

答复

200 - OK
返回: object
version string
deleted boolean
contentLength number
createdTime string
objectCreatedTime string

必要权限

  • 创建条目
  • 更新条目

删除条目

DELETE /v1/universes/{universeId}/standard-datastores/datastore/entries/entry

参数

universeId number
Path
必填
datastoreName string
entryKey string
scope string

请求

curl

curl --include --location --request DELETE "https://apis.roblox.com/datastores/v1/universes/3310576216/standard-datastores/datastore/entries/entry" \
--header "x-api-key: ${API_KEY}" \
--get \
-d "datastoreName=Coins" \
-d "entryKey=269323"

答复

必要权限

  • 删除条目

增量输入

POST /v1/universes/{universeId}/standard-datastores/datastore/entries/entry/increment

参数

universeId number
Path
必填
datastoreName string
entryKey string
incrementBy number
scope string
roblox-entry-attributes string
Header
roblox-entry-userids string
Header

请求

curl

curl --include --location --request POST "https://apis.roblox.com/datastores/v1/universes/3310576216/standard-datastores/datastore/entries/entry/increment" \
--header "x-api-key: ${API_KEY}" \
--header 'content-length: 0' \
--get \
-d "datastoreName=Coins" \
-d "entryKey=269323" \
-d "incrementBy=3"

答复

200 - OK
返回增加后的最新版本。
返回: object
application/json

{
"content-md5": "K4phWUsfTE2wkCqKOVztkw==",
"roblox-entry-version": "08D9E6A3F2188CFF.0000000009.08D9E6DF74AC5F42.01",
"roblox-entry-created-time": "2022-02-02T23:30:06.5388799+00:00",
"roblox-entry-version-created-time": "2022-02-03T06:36:05.9184962+00:00",
"roblox-entry-userids": []
}
roblox-entry-created-time string
last-modified string
roblox-entry-version string
roblox-entry-attributes string
roblox-entry-userids array<number>
content-md5 string

必要权限

  • 创建条目
  • 更新条目

获取入门版本

GET /v1/universes/{universeId}/standard-datastores/datastore/entries/entry/versions/version

参数

universeId number
Path
必填
datastoreName string
entryKey string
versionId string
scope string

请求

curl

curl --include --location --request GET "https://apis.roblox.com/datastores/v1/universes/3310576216/standard-datastores/datastore/entries/entry/versions/version" \
--header "x-api-key: ${API_KEY}" \
--get \
-d "datastoreName=Coins" \
-d "entryKey=269323" \
-d "versionId=08D9E6A3F2188CFF.0000000003.08D9E6DE485A7680.01"

答复

200 - OK
返回: object
application/json

{
"content-md5": "sTf90fedVsft8zZf6nUg8g==",
"roblox-entry-version": "08D9E6A3F2188CFF.0000000003.08D9E6DE485A7680.01",
"roblox-entry-created-time": "2022-02-02T23:30:06.5388799+00:00",
"roblox-entry-version-created-time": "2022-02-03T06:27:42.0652160+00:00",
"roblox-entry-attributes": {},
"roblox-entry-userids": [ 269323 ]
}
roblox-entry-created-time string
last-modified string
roblox-entry-version string

必要权限

  • 读取版本

限制

每个 API 密钥:每个 IP 地址每 60 秒有 100 次请求

列出入库版本

GET /v1/universes/{universeId}/standard-datastores/datastore/entries/entry/versions

参数

universeId number
Path
必填
datastoreName string
entryKey string
scope string
cursor string
startTime string
endTime string
sortOrder string
limit number

请求

curl

curl --include --location --request GET "https://apis.roblox.com/datastores/v1/universes/3310576216/standard-datastores/datastore/entries/entry/versions" \
--header "x-api-key: ${API_KEY}" \
--get \
-d "datastoreName=Coins" \
-d "entryKey=269323" \
-d "limit=5"

答复

200 - OK
返回: object
version string
deleted boolean
contentLength number
createdTime string
objectCreatedTime string

必要权限

  • 列表版本

对象

下列对象描述了接受或返回的有效载荷。请参阅每个单独的端点,以了解更多关于这些对象用途的信息。

DataStore

属性

name string
createdTime string

EntryVersion

属性

version string
deleted boolean
contentLength number
createdTime string
objectCreatedTime string