Skip to main content

Get Item Count

Retrieves the number of items in the inbox.

URL Confirmation

This API uses the service-api.playnanoo.com domain.

API Information

  • URL: https://service-api.playnanoo.com/inbox/v20220901/count
  • Method: PUT
  • Authentication Required: Yes

Request Parameters

ParameterTypeRequiredDescription
table_codestringRequiredTable code

Response Data

Inbox item count is returned.

Code Example

void UMyGame::GetInboxCount(const FString& TableCode)
{
// 플레이어 정보가 포함된 요청 바디 생성
TSharedPtr<FJsonObject> Body = FPlayNANOOHelper::CreateRequestBody();
Body->SetStringField(TEXT("table_code"), TableCode);

// JSON 문자열 변환
FString JsonBody = FPlayNANOOHelper::ToJsonString(Body);

// HTTP 요청
TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->SetURL(TEXT("https://service-api.playnanoo.com/inbox/v20220901/count"));
Request->SetVerb(TEXT("PUT"));
FPlayNANOOHelper::SetCommonHeaders(Request, true); // 인증 토큰 포함
Request->SetContentAsString(JsonBody);

Request->OnProcessRequestComplete().BindLambda(
[](FHttpRequestPtr Req, FHttpResponsePtr Res, bool bSuccess)
{
if (bSuccess && Res.IsValid())
{
TSharedPtr<FJsonObject> JsonObject;
TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Res->GetContentAsString());

if (FJsonSerializer::Deserialize(Reader, JsonObject))
{
int32 Count = JsonObject->GetIntegerField(TEXT("count"));
UE_LOG(LogTemp, Log, TEXT("우편함 아이템 개수: %d"), Count);
}
}
});

Request->ProcessRequest();
}
Table Code

table_code is the code of the inbox table created in the PlayNANOO console.