question

ophilbert avatar image
ophilbert asked

[Cloud Script]Change User display name

Hi,

My question is similar to this one as I want to apply some server logic before setting player's name but can't access this method using the Server API. I tried using the REST API to do so but I get an internal error every time.

Here's my script:

var contentType = "application/json";
var header = JSON.stringify
({
	"Content-Type":"application/json",
	"X-SecretKey":"MY_SECRET_KEY"
});


var body = JSON.stringify
({
	"DisplayName":"New Name",
	"PlayFabId":currentPlayerId,
});

var response = http.request("https://MYTITLEID.playfabapi.com/Admin/UpdateUserTitleDisplayName", "POST", body, contentType, header);

And the response I get from that http call

{"url":"https://MYTITLEID.playfabapi.com/Admin/UpdateUserTitleDisplayName","method":"POST","content":"{\"DisplayName\":\"New Name\",\"PlayFabId\":\"ID_OF_THE_PLAYER\"}","contentType":"application/json","headers":"{\"Content-Type\":\"application/json\",\"X-SecretKey\":\"MY_SECRET_KEY\"}","result":{"responseContent":null,"httpStatus":null,"httpStatusCode":0,"requestError":"InternalError"},"httpRequestError":"InternalError"}

Is that something we aren't supposed to do and therefore it's not supported?

Any help on that matter would be appreciated. Thanks.

@Brendan maybe?

apisCloudScript
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

Correct - you should not attempt to make Admin API calls from Cloud Script. We specifically provide the ability to make Server API calls from Cloud Script and have exposed a number of API calls that way that are valid for use (though please note - writing to Title Data must not be as a result of a player action - it's only there for use in non-segment Scheduled Tasks). Once we've added the display name update API call to the Server API, we'll be posting a follow-up to the original thread.

5 comments
10 |1200

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

ophilbert avatar image ophilbert commented ·

Ok thanks.

0 Likes 0 ·
harsh avatar image harsh ophilbert commented ·

2020 and no API.

0 Likes 0 ·
k-krrs avatar image k-krrs commented ·

It's 2018 and we still don't have this added to the API. Any ETA on this?

0 Likes 0 ·
brendan avatar image brendan k-krrs commented ·

To be completely transparent, nothing is a trivial change (we require a full set of tests be added for any change or addition, since we're a live service now running over 1,800 live titles), so we have to carefully prioritize what time we have. A significant part of prioritization is, how many people need a particular feature - which we track via feedback here and elsewhere. So it's not a question of when something is originally brought up, but how impactful it will be. At the moment, there are a number of things ahead of this, going by that prioritization, but we'll bump the backlog item to note that you also asked about it.

2 Likes 2 ·
k-krrs avatar image k-krrs brendan commented ·

Okay, thank you for the quick reply!

0 Likes 0 ·

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.