道具 使用
在邮箱中使用单个物品。
URL确认
此API使用 service-api.playnanoo.com 域名。
API信息
- URL:
https://service-api.playnanoo.com/inbox/v20220901/consume/item - Method:
PUT - 需要认证: 是
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| item_key | string | 必填 | 要使用的物品密钥 |
响应数据
Res类
| 字段 | 类型 | 说明 |
|---|---|---|
| items | FSerializeItems[] | 已使用的物品列表 |
FSerializeItems 结构
| 字段 | 类型 | 说明 |
|---|---|---|
| item_code | FString | 道具 代码 |
| item_count | int32 | 道具 数量 |
代码示例
void UMyGame::ConsumeInboxItem(const FString& ItemKey)
{
// 플레이어 정보가 포함된 요청 바디 생성
TSharedPtr<FJsonObject> Body = FPlayNANOOHelper::CreateRequestBody();
Body->SetStringField(TEXT("item_key"), ItemKey);
// JSON 문자열 변환
FString JsonBody = FPlayNANOOHelper::ToJsonString(Body);
// HTTP 요청
TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->SetURL(TEXT("https://service-api.playnanoo.com/inbox/v20220901/consume/item"));
Request->SetVerb(TEXT("PUT"));
FPlayNANOOHelper::SetCommonHeaders(Request, true); // 인증 토큰 포함
Request->SetContentAsString(JsonBody);
Request->OnProcessRequestComplete().BindLambda(
[](FHttpRequestPtr Req, FHttpResponsePtr Res, bool bSuccess)
{
if (bSuccess && Res.IsValid())
{
UE_LOG(LogTemp, Log, TEXT("우편함 아이템 소비 성공"));
}
});
Request->ProcessRequest();
}
道具 Key
item_key是邮箱物品列表查询API返回的物品唯一密钥。