Skip to main content

Get Friend Request List

Retrieves the list of pending friend requests.

URL Verification

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

API Information

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

Request Parameters

ParameterTypeRequiredDescription
table_codestringRequiredFriend table code

Response Data

FieldTypeDescription
ItemsarrayList of pending friend requests

Items Array Elements

FieldTypeDescription
RelationshipCodestringRelationship code
UserIdstringUser ID
NicknamestringNickname
TimezonestringTimezone
AccessSecondsnumberLast access time (in seconds)

Code Example

void UMyGame::GetPendingFriendRequests(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/searchPending"));
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))
{
const TArray<TSharedPtr<FJsonValue>>* Items;
if (JsonObject->TryGetArrayField(TEXT("Items"), Items))
{
for (const auto& Item : *Items)
{
TSharedPtr<FJsonObject> Request = Item->AsObject();
FString Nickname = Request->GetStringField(TEXT("Nickname"));
FString RelationshipCode = Request->GetStringField(TEXT("RelationshipCode"));
UE_LOG(LogTemp, Log, TEXT("Requester: %s, RelationCode: %s"), *Nickname, *RelationshipCode);
}
}
}
}
});

Request->ProcessRequest();
}
Accept/Decline

Pending friend requests can be accepted using the accept API or declined using the delete API.