跳到主要内容

Bank Inventory

概要​

创建/更新/获取/删除游戏物品信息所需的 API。

信息

关于使用梦宝币对物品进行收费的详情,请同时参见教程。

Bank Inventory 对象字段​

向Bank Inventory API 发送请求后,会反馈Bank Inventory 对象。

值说明类型
id物品 IDxs:string
name物品名xs:string
price物品价格xs:int
description物品说明xs:string
imageUrl物品图片的 URLxs:string

端点URL​

Sandbox环境

https://sb-app.mobage.jp/social/api/restful/v2.02/bank/inventory/{appid}/{-list|,|itemId}

正式环境

https://app.mobage.jp/social/api/restful/v2.02/bank/inventory/{appid}/{-list|,|itemId}

API请求​

HTTP 方法​

  • Authorization Code Grant
    • GET 获取已注册的游戏物品列表。
  • Client Credentials Grant
    • GET 获取已注册的游戏物品列表。
    • POST 创建游戏物品信息。
    • PUT 更新游戏物品信息。
    • DELETE 删除游戏物品信息。

API响应​

HTTP状态代码HTTP 状态信息说明
200OK获取数据成功时
201Created数据获取已生成时
202Accepted数据获取已更新时
400Bad Request客户端的请求数据不当
401Unauthorized认证错误
403Forbidden资源存在,但由于认证错误以外的原因导致不能访问的情况
404Not Found资源不存在
500Internal Server ErrorAPI 服务器端的错误
503Service UnavailableAPI 暂时不可用时

样例​

获取已注册的全部物品列表​

请求格式​

GET /social/api/restful/v2.02/bank/inventory/@app

响应格式

200 OK

{
"entry":[
{"id":"life_pack_1"},
{"id":"booster"}
],
"startIndex":1,
"sorted":false,
"itemsPerPage":2,
"updatedSince":false,
"totalResults":2,
"filtered":false
}

只获取指定的物品​

请求格式​

GET /social/api/restful/v2.02/bank/inventory/@app/booster,life_pack_1?fields=price,description

响应格式

200 OK
{
"entry":[
{
"id":"booster",
"price":200,
"description":"A booster that doubles your score immediately."
},
{
"id":"life_pack_1",
"price":100,
"description":"You got 3 life."
}
],
"startIndex":1,
"sorted":false,
"itemsPerPage":2,
"updatedSince":false,
"totalResults":2,
"filtered":false
}
 

生成物品信息​

请求格式​

POST /social/api/restful/v2.02/bank/inventory/@app
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9
Content-Type: application/json; charset=utf-8

{
"id":"life_pack_2",
"name": "Sample Item2",
"price": 100,
"imageUrl": "http:\/\/mobage.com\/homepage-assets\/images\/icon.png",
"description": "This is a sample item"
}

响应格式

201 Created
 

更新物品信息​

请求格式​

PUT /social/api/restful/v2.02/bank/inventory/@app/life_pack_2?fields=price,imageUrl
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9
Content-Type: application/json; charset=utf-8

{
"price": 350,
"imageUrl": "ttp:\/\/mobage.com\/homepage-assets\/images\/icon2.png",
}

响应格式

202 Accepted
 

删除物品信息​

请求格式​

DELETE /social/api/restful/v2.02/bank/inventory/@app/life_pack_2
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9
Content-Type: application/json; charset=utf-8

响应格式

202 Accepted