Skip to main content

Get Friend Information

Retrieves the number of friend relationships and pending friend requests.

URL Verification

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

API Information

  • URL: https://service-api.playnanoo.com/friend/v20231201/info
  • Method: PUT
  • Authentication Required: Yes

Request Parameters

ParameterTypeRequiredDescription
table_codestringRequiredFriend table code

Response Data

FieldTypeDescription
RelationshipCountnumberCurrent number of friends
PendingCountnumberNumber of pending friend requests

Code Example

void UMyGame::GetFriendInfo(const FString& TableCode)
{
// Create request body with player information
TSharedPtr<FJsonObject> Body = FPlayNANOOHelper::CreateRequestBody();
Body->SetStringField(TEXT("table_code"), TableCode);

// Convert to JSON string
FString JsonBody = FPlayNANOOHelper::ToJsonString(Body);

// HTTP request
TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->SetURL(TEXT("https://service-api.playnanoo.com/friend/v20231201/info"));
Request->SetVerb(TEXT("PUT"));
FPlayNANOOHelper::SetCommonHeaders(Request, true); // Include auth token
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 RelationshipCount = JsonObject->GetIntegerField(TEXT("RelationshipCount"));
int32 PendingCount = JsonObject->GetIntegerField(TEXT("PendingCount"));
UE_LOG(LogTemp, Log, TEXT("Friend count: %d, Pending requests: %d"), RelationshipCount, PendingCount);
}
}
});

Request->ProcessRequest();
}
Notification Display

You can use PendingCount to display a notification badge when there are pending friend requests.