question

mchen0358 avatar image
mchen0358 asked

SetFriendTag Return error 500 Internal server error

First Problem:

setTagFriend API return error 500. I made request with client API in actionscrupt (as3)

here is how i call

var req:SetFriendTagsRequest = new SetFriendTagsRequest();
req.Tags = new Vector.<String>();
req.Tags.push("");
req.FriendPlayFabId = "other playfab id";
PlayFabClientAPI.SetFriendTags(req, onSetTagSuccess, onError);

It return errors 500 Internal server error.

Second Problem,

Bot updated of PlayerTag. I send a blank array ([]) to "TagsRequest" and it doesn't change. as suggested answer on Two way friends request as it says "remove the tags from both players" does it mean remove the "Tags" property right? i want the result of "GetFriendList"

Here how i send the request:

// From AS3

var req:SetFriendTagsRequest = new SetFriendTagsRequest();
req.Tags = new Vector.<String>();
req.FriendPlayFabId = "other playfab id";
PlayFabClientAPI.SetFriendTags(req, onSetTagSuccess, onError);

----------------------------------------------------------------------------

// From Cloud Script.js

server.SetFriendTags({
	"PlayFabId": receiverId,
	"FriendPlayFabId": currentPlayerId,
	"Tags": []
});


Expected Result:

{
 "code": 200,
 "status": "OK",
 "data": {
  "Friends": [
   {
    "FriendPlayFabId": "playfabId",
    "TitleDisplayName": "Title",
    "FacebookInfo": {}
   },
   {
    "FriendPlayFabId": "playfabId",
    "TitleDisplayName": "Title",
    "FacebookInfo": {}
   }
  ]
 },
 "CallBackTimeMS": 1031
}

Instead of:

{
 "code": 200,
 "status": "OK",
 "data": {
  "Friends": [
   {
    "FriendPlayFabId": "playfabId",
    "TitleDisplayName": "Title",
    "Tags":[] // or "Tags":[" "]
    "FacebookInfo": {}
   },
   {
    "FriendPlayFabId": "playfabId",
    "TitleDisplayName": "Title",
    "FacebookInfo": {}
   }
  ]
 },
 "CallBackTimeMS": 1031
}

Thanks.

Friends
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

The 500 error is because the tag list you're sending includes the tag "". So, if the list of tags you're attempting to set it "foo" and "bar", your array in that call is:

[ "foo", "bar", "" ]

I'll file a bug to check for an ignore zero-length strings, but if you remove that, the code will work fine.

For the second issue, it appears that if you submit an empty array of tags, we are simply skipping the operation and returning "OK". Obviously, since the call to SetFriendTags is meant to replace the existing tags on the friend with those specified, you would expect that sending an empty array would remove everything. However, since that's not the behavior to date, we can't really change it, as that would change the behavior and could break an existing title which is using the call. What I would recommend therefore, is that rather than sending an empty array when you want to clear the set of tags for the friend, send an array containing only a single tag that indicates that the tag list is empty.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.