what is POST https://{ {TitleID}}.playfabapi.com/Server/AddFriend Content-Type: application/json X-SecretKey:<developer_secret_key> at start of cloudscript? Why is it necessary and how we can avoid it incase it is avoidable?
what is POST https://{ {TitleID}}.playfabapi.com/Server/AddFriend Content-Type: application/json X-SecretKey:<developer_secret_key> at start of cloudscript? Why is it necessary and how we can avoid it incase it is avoidable?
The AddFriend call might look like this, but it doesn't have to be at the "start" of a Cloud Script:
var request = {
PlayFabId: currentPlayerId, FriendPlayFabId: args.FriendPlayFabId
};
var result = server.AddFriend(request);
And, of course, there are other parameters you can use to look up the friend to be added.
But I'm not sure what you mean concerning "Why is it necessary and how we can avoid it incase it is avoidable?"
It's not "necessary" to add friends - you only need to do that if you want to use the PlayFab friends system. Can you clarify what you're asking?
@Brendan
POST https://{ {TitleID}}.playfabapi.com/Server/AddFriend
Content-Type: application/json
X-SecretKey:<developer_secret_key>
I was asking about above syntax. I have seen it in every cloudscript. Can you explain it to me?
Can you please specify where you're seeing a Cloud Script that uses this format? It is not necessary to use the Secret Key in any Cloud Script call. The Server API calls can be made exactly as shown above - the fact that they're running in Cloud Script means that the Secret Key is already part of the call.
@Brendan I am getting this error
after uploading this cloudscript
Can you tell me what I am doing wrong and also tell me what I have to add to it?
2 People are following this question.