question

Damian Rajamanie avatar image
Damian Rajamanie asked

SetTitleData Error reaults in: The URL for this request is not valid for this title. The correct API endpoint is

Hello, we are using Unity and we have an Editor windows that we want our designeer to hit a button and upload data to a Title Key.

We're currently doing this in Edit mode rather tan running the game in case that's a thing. When we do the following code:

PlayFabServerAPI.SetTitleData( new PlayFab.ServerModels.SetTitleDataRequest { Key = k.Key, Value = k.Value, }, result => { promise.Resolve("Stats Uploaded"); m_uploadFinished = true; }, error => { throw new Exception("Error upload stats:" + error.ErrorMessage); } );

We get ther error:

The URL for this request is not valid for this title. The correct API endpoint is Blah Blah

I am unsure as to what to do, after some forum and internet posts I got something about the 'Secret Key' is wrong or somethign, but if I check our Playfab Settings it's all valid. Then I read some stuff that indicated CloudScript which I know nothing about.

wondering why this would fail and how to go about pushing the value to the key for the Titledata from the Unity Editor window. If it's cloud script what sort of stuff do we need to look into and learn, the example for hello wrld etc. I couldn't see anything about TitleData

cheers

10 |1200

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

Andy avatar image
Andy answered

That message generally means that you're providing the wrong secret key for accessing the server API. That's complicated somewhat by the fact that the Unity editor extensions are supposed to handle the secret key for you.

Can you provide me the title id so that I can check our logs to see what might be happening?

10 |1200

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

Damian Rajamanie avatar image
Damian Rajamanie answered

Yeah the Secret Key was what I gleaned from research, but I didn't know how to set it from code. In the Playfab Editor Extensions (When it works, mine often says 'Install SDK :( ) switching TitleID shows the Secret Key updated immediately.

What we're doing in our code is: PlayFabSettings.TitleId = "BA50" just prior to calling PlayFabClientAPI.LoginWithCustomID();

Sometimes we will want to upload data to "944F" so we will change to that Titleid and call PlayFabClientAPI.LoginWithCustomID();

Essentially whenever we switch those titles we 're authenticate' (couldn't find a way to log off, but nothing fails during this step)

If we use BA50, it might fail, and then a 2nd time pass. But for example I changed to 944F and I get the following error:

Exception: Error upload stats:The URL for this request is not valid for this title. The correct API endpoint is https://ba50.playfabapi.com:443

So the URL, and I suspect therefore the Secret Key is stuck pointing to the other Title, even though we just logged in and authed/got a session ticket for 944F.

Doing this a 2nd time, 'might' then work, but I just tried again and it's stuck looking for that URL.

This is bad for us in a couple of ways potentially as it might mean that we upload the wrong stuff to the wrong title by accident. I just want to choose my title, log in, get a session ticket and then upload some data to that title.

thanks for your help, I hope that it is clear engouh from my explanation

3 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.

Damian Rajamanie avatar image Damian Rajamanie commented ·

One thing I just noticed in my diff, was the PlayFabSharedSettings.asset has deleted the 944F and secret key entry and replaced it with the BA50 on. So... as I click my button to choose the title id and go through the auth, the Editor Extensions shows this change immediately, which looks like it's all groovy, so the title and the secret key change in the Editor Extensions, just like if I we to choose them directly in the drop down. If I hit Save Project, my diff of that file reflects the change as well

0 Likes 0 ·
Andy avatar image Andy ♦♦ Damian Rajamanie commented ·

It sounds like your scenario may not be fully-supported by the editor extension, especially if you're setting the title id in code. I'd recommend also setting the Secret Key in code. You can set it using PlayFabSettings.DeveloperSecreteKey.

0 Likes 0 ·
Damian Rajamanie avatar image Damian Rajamanie Andy ♦♦ commented ·

On the surface setting the key after setting the title id in code 'appears' to work, I'm not getting any errors and on a quick test it looked like I was able to push the data to whichever Title I have chosen. I am getting a different error, (my logic, that we'll need to figure out before I can 100% confirm, but it does look like that works at the moment, from what I can tell.

thanks :)

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.