Get Friend List
Retrieves the list of registered friends.
URL Verification
This API uses the service-api.playnanoo.com domain.
API Information
- URL:
https://service-api.playnanoo.com/friend/v20231201/search - Method:
PUT - Authentication Required: Yes
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| table_code | string | Required | Friend table code |
Response Data
| Field | Type | Description |
|---|---|---|
| Items | array | Friend list |
Items Array Elements
| Field | Type | Description |
|---|---|---|
| RelationshipCode | string | Relationship code |
| UserId | string | User ID |
| Nickname | string | Nickname |
| Timezone | string | Timezone |
| AccessSeconds | number | Last access time (in seconds) |
Code Example
void UMyGame::GetFriendList(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/search"));
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> Friend = Item->AsObject();
FString Nickname = Friend->GetStringField(TEXT("Nickname"));
FString RelationshipCode = Friend->GetStringField(TEXT("RelationshipCode"));
UE_LOG(LogTemp, Log, TEXT("Friend: %s, RelationCode: %s"), *Nickname, *RelationshipCode);
}
}
}
}
});
Request->ProcessRequest();
}
Table Code
Before using the friend feature, you need to create a friend table code in the PlayNANOO admin console.