Sign In Register

How can we help you today?

Start a new topic

getting request id to accept friend request

Hi I worked through the Creating Custom Friends Lists tutorial and have everything working in gamesparks, the problem I'm having now is when I call AcceptFriend from C# I'm just not sure how to get the requestId for the friend request.
//get list of pending inventations

        new LogEventRequest().SetEventKey("GET_FRIEND_REQUESTS").Send((response) =>


            List<GSData> friendRequestData = response.ScriptData.GetGSDataList("friendsList");


            print("RESPONSE: " + response.JSONString);


            foreach (GSData item in friendRequestData)


                print("Friend ID ====> " + item.GetString("friendId"));

                print("Display Name => " + item.GetString("displayName"));                 


                Friend f = Instantiate(friendAcceptButtonPrefab);

                f.playerId = item.GetString("friendId");

                f.displayName = item.GetString("displayName");

                f.requestId = response.RequestId;

^^ this is where I need the to set the friend requestId I'm currently getting the id for something else friendRequest data does not contain the requestId






I was thinking I could query the messages for friend request messages and check for the playerId, but not sure if it's the best way or exactly how to do that.

1 Comment

Hi customer service helped me and I wanted to share the answer. they told me I needed _id.$oid field, I modified the GET_FRIEND_REQUESTS:

while ( friendsCursor.hasNext())


   var friend =;


       "friendId" : friend.friendId,

       "displayName" : friend.displayName,

       //added line below
       "requestId" : friend._id.$oid


then the friendList I get from LogEventRequest() containse the requestId.
Now the only problem I have is that it's adding the new player and them-self to the friendslist..
I was thinking to check in ACCEPT_FRIEND_REQUEST that the playerId is not the same before adding to the friendlist, just have to figure out how.

Login to post a comment