Tournament Widget not working and api key question [solved]

#1

Hello,

first of all, thanks for opening up FaceIT for developers!

First question: The tournament widget doesn’t show any data for either of my two tournaments: 3643019d-e9b5-4f05-b6c4-b5ab7894f2ab and 74a96846-bf37-4ebf-a3be-a0eedff59172

Is that feature not yet available for custom tournaments or am I doing something wrong?

2nd question: The API key is shown in plain text within the iFrame URL - doesn’t that pretty much render the use of API keys useless, if everybody can simply access my key like that?

<iframe src="https://widgets.faceit.com/index.html#/tournament/74a96846-bf37-4ebf-a3be-a0eedff59172#apiKey=XXXXX&showFooter=false&showHeader=false" style="{width: 350px, height: 350px}"></iframe>

And I just found a bug in this editor:
When you hit the “code” format option without selecting a text it says “indent preformatted text by 4 spaces” which is wrong. When you select a text and then hit the code-button, it properly surrounds it with `.

Best regards,
Mario

#2

Hi,

I’m not sure about the first question but for number 2 there are two types of API key in the FACEIT developer tools: server-side and client-side api keys.

A client side api key is intended to be used publicly such as in front end JavaScript code or in a widget in your case. As the key is exposed in the user’s browser it will never be possible to fully hide it.

I guess some benefits of public API key over no API key are:

  • Rate limits can be updated for each application independently
  • Could be used for tracking so FACEIT knows whose API keys are being used for what etc…

I think it is unlikely that someone would use your API key unless they were trying to ‘harm’ you specifically such as using up your rate limit by spamming the API using your key - which is not something that would be fully prevented if you used a server side key locked behind your own API.

So you should be fine for question 2 and you could change your API key or reach out to FACEIT if you notice someone abusing your key

Thanks,
Osbar

#3

I am not familiar with tournaments, would you be able to post a link to the tournament on the FACEIT website?

Is it possible that the tournament is private or the id is incorrect?

#4

Hi Osbar!

Thanks for your reply, the API Key answer makes sense somehow, as it’s a no critical data that is used by that key.
Now that I think of it, I am surprised that there is a need for an API Key for web widgets at all, because usually all embed functions of other platforms don’t need any verification. But I guess FaceIT wants to do some analysis of the widget usage, so it’s fine.

Regarding the tournament, here’s a link to one that’s already started:
https://www.faceit.com/en/championship/74a96846-bf37-4ebf-a3be-a0eedff59172/

I used the ID in the URL for the web widget, not sure if that is the correct way though.
I got the idea by using the Web Widgets Configurator (https://developers.faceit.com/docs/tools/web_widgets) to get the iFrame code mentioned above.

#5

I was just browsing through the Data API and trying to check the ID of my tournament, seems like I can’t find it via the API at all. I’ve tried several endpoints without any luck. That’s probably why the iframe widget isn’t working as well.

I’m not even sure if my tournament is a tournament or a championship. It’s listet in the UI under “Tournaments” but in the URL it says /championship/

Any ideas?

#6

It looks like what you have is a championship which doesn’t seem to work with the tournament widget.

I just created a tournament to test and it seemed to work fine, but I couldn’t see an option to create a championship like yours.

Are you able to create it as a tournament rather than a championship? If so then it should work but I’m not sure if it will have the same features as a championship.

#7

How did you create your tournaments to begin with?

#8

I’m also starting to think that it’s a championship, but for some reason I can’t find it via the Data API Endpoint for championships either: https://open.faceit.com/data/v4/championships/74a96846-bf37-4ebf-a3be-a0eedff59172

We (alpenScene) are a “verified organisator”, so we’re able to create special tournaments (maybe championships?) and I think we need some of the features this kind of tournament provides, compared to normal tournaments.

If there is no ready-to-use widget for this, I would just use the Data API to gather some information. But unfortunately, I also don’t seem to find anything about the tournament there either.


Alright, I just found something! The above mentioned base endpoint for the championship /championships/{championship_id} indeed returns a 404-not-found. But using the leaderboards endpoint /leaderboards/championships/{championship_id} I finally see my data! Even the group standings are working - that’s pretty much exactly what I was looking for.

I’m just really wondering the the base championship endpoint is giving a 404, that was a wild distraction :slight_smile:

#9

So the short solution to my problem:

  • The Tournament Widget was the wrong choice for me since I am talking about “championships”.
  • The root endpoint for champions /championships/{id} somehow is not working for me
  • The leaderboard endpoints for championships is working /leaderboards/championships/{id}

Thanks for pointing me to the right direction, Osbar :clap:! Have a great day :sunny:

#10

Glad to help :slight_smile:

It might be worth reporting the bug about /championships/{id} 404 to FACEIT and maybe request a widget for championships

Cheers

1 Like
#11

I just looked for a way to report a bug, couldn’t really find any official way. Is there another one besides this forum? If not, I’ll create a topic about that 404.

#12

I don’t think there is an official way and the “bug” tag can only be added to topics in the “User Feedback” category, not developers :cry:

#13

Hi mrioa,
the data-api is not returning the championships that are not published: 74a96846-bf37-4ebf-a3be-a0eedff59172 is not published, and that’s why you get 404.

Cheers
Lorenzo

#14

Hi Lorenzo!

Sorry for the late response and thanks for the hint, it really seems to have unpublished as a status. Why is it though? Everyone can see the championship with the link and it is already “ongoing” for two weeks now. The other endpoints are working as well.

For unpublished championships:

  • /championships/{championship_id} - not working
  • /championships/{championship_id}/matches - working
  • /leaderboards/championships/{championship_id}/groups/{group} - working

Imho that is a quite irritating behavior. Or am I missing something that justifies that status only affecting the /championship/{id} endpoint?

Thanks in advance,
Mario