Skip to content

Latest commit

 

History

History
169 lines (116 loc) · 15.5 KB

File metadata and controls

169 lines (116 loc) · 15.5 KB

FAQ

How to get live and pre-match data from the API?

If you're seeking live and pre-match data, such as statistics, you will have to interact with specific API endpoints labeled with "Match". These can be conveniently located on the RapidAPI page.

Using the built-in search tool within the endpoints tab on RapidAPI, you can simply type 'Match'. This will instantly return a comprehensive list of all related endpoints, including data categories like statistics, incidents, odds, and more. This efficient method will help you quickly find the necessary endpoints for retrieving the data you need.

How to Retrieve Player Statistics from a Match?

There are two primary methods to access player statistics. The first method involves using the 'Match Lineups' endpoint, for example: 'Football Match Lineups'. This endpoint provides comprehensive data about all participating players, inclusive of their respective statistics.

The second approach utilizes the 'Match Player Statistics' endpoint. By inputting a specific player's id, you can directly retrieve that player's statistics. Both methods can be accessed effortlessly through the search tool in the endpoints tab on the RapidAPI page.

Methods for Displaying Images on Your Website

All image or logo endpoints return responses in image/png format, with placeholders being the only exception, which return SVG images. To integrate these images on your website, considering the necessary authorization headers for the API calls, you have several practical options:

  1. Fetch API: Use JavaScript's Fetch API or other similar HTTP libraries like Axios to send a GET request to the endpoint. Then, set the response as a source for an HTML img element. The Fetch API allows for the setting of specific headers, accommodating the need for authorization.
  2. Base64 Conversion: Convert the image to a base64 string using JavaScript after making an authorized fetch request. This allows for dynamic rendering of the image on your website.
  3. Server-side Proxy: Implement a server-side proxy that handles the authenticated request to the API, retrieves the image, and then serves it to the front-end of your website. This approach isolates the API credentials on the server, improving security.
  4. Canvas API: Another dynamic approach, especially useful when needing to manipulate images further, is to use JavaScript's Canvas API. Fetch the image via an authorized request, then draw it onto a canvas element.

Each method has its own benefits, so choose the one that best aligns with your website's requirements and your comfort with JavaScript and server-side programming.

Determining the Match Time

When you interact with any match endpoint, we provide an array of detailed information. Among these, the attribute "statusTime" is vital to determining the match's ongoing time:

  • "statusTime": Contains data about the current time of the match. With this information, you can perform simple mathematical operations to calculate the seconds that have passed since the beginning of the period. Specifically, the current time is calculated as: (current timestamp - event["statusTime"]["timestamp"]) + event["statusTime"]["initial"].

If you aim to implement the time in a "time + added time" format, the current added time after the official period (e.g., the standard 45 minutes for football/soccer), would follow the below logic:

  • If (current timestamp - event["statusTime"]["timestamp"]) > event["statusTime"]["max"], then the added time would be: (current timestamp - event["statusTime"]["timestamp"]) - event["statusTime"]["max"].

We also offer an attribute called "time" which encompasses "injuryTime" - the maximum additional time granted by the referee, also known as injury time.

Please note, all timestamps we provide are in seconds.

Guidance on Building Your Website or Application with Our API

Embarking on the journey to develop your website or application using our API? Rest assured, you're not alone. Our team is more than ready to offer their expertise and walk you through the entire process.

If you require support, feel free to reach out to us via the 'About' tab. Whether you're navigating a technical challenge or seeking best-practice advice, we're here to help at no extra cost. Building your digital presence with our API should be a smooth and enriching experience, and we're committed to ensuring just that.

Availability of Betting Odds through Our API

Yes, our API does provide odds for your convenience. Apart from motorsport and esports, odds are available for all other sports, primarily sourced from bet365, one of the leading betting companies. These odds are intended for general and referential use.

If you require specialized odds, we recommend considering our odds service, Pinaculo and Uniodds. It offers a more detailed and sport-specific array of betting odds to suit your needs.

Understanding Match Incidents and Status

The incidents and status of a match can be interpreted using specific attributes and their respective values in the data provided by the API. Here's a detailed explanation:

Incidents

Descriptions of incidents can be extracted through the "incidentType", "incidentClass", or "text" attributes. Here's a breakdown of their possible values:

  • incidentType: Can be "period", "penaltyShootout", "card", "substitution", "injuryTime", "goal", "varDecision", "inGamePenalty".
  • incidentClass: Various values depending on the incident type, such as:
    • For "penaltyShootout": "scored", "missed".
    • For "card": "red", "yellow", "yellowRed".
    • For "goal": "penalty", "regular", "ownGoal".
    • For "substitution": "injury", null.
    • For "varDecision": "penaltyNotAwarded", "goalAwarded", "cardUpgrade", with a subsequent 'confirmed' attribute that could be true or false.
    • For "inGamePenalty": "missed".
  • text: Specific to "period", can be "HT", "FT", "ET", "PEN".

Status

The status of the match is described using two properties:

  • type: Provides a code string to represent the match status. Possible returns are: 'inprogress', 'finished', 'postponed', 'interrupted', 'canceled', 'notstarted’.
  • description: Offers a more understandable text of the status. For football, this can include '1st half', '2nd half', 'Halftime', 'Ended', 'Postponed', 'Canceled', 'Not started', "AP" (After Penalties), "AET" (After Extra Time), "1st extra", "Extra time halftime", "2nd extra", "Awaiting penalties", "Penalties", "Awaiting extra time".

Navigating Our API: Step-by-Step Guidance

We understand that our comprehensive API, combining data from various sports APIs, might appear complex at first glance. If you're finding it challenging to understand the endpoints, we recommend approaching it one API at a time. Test each one and familiarize yourself with their functionalities. Remember, the structure of the endpoints remains consistent across different hosts.

Here are the individual API links for each sport:

Once you access these individual APIs, you'll notice that the endpoints are grouped into four main categories:

  • Matches: This group offers information about matches or schedules, such as Lineups, Statistics, Incidents, Highlights, and Odds.
  • Teams: Here you'll find data about teams, including Squads, Statistics, Logos, and Transfers.
  • Players: Provides information about individual players, including Statistics, Images, and Transfer History.
  • Managers: This section includes data on managers, their Career History, Images, and details of their Last Matches.

If you're still encountering difficulties, don't hesitate to reach out to us. We're here to help, and we're also open to suggestions for new features.

The Reason Behind Not Providing Widgets

We prioritize the security of our users and take every measure to ensure your data, including your API key, remains confidential. Widgets have the potential to expose your API key to users, creating a significant security risk.

Given this concern, instead of offering widgets, we extend our support to help you during the development phase of your application. Our team is readily available to assist you with any challenges or questions you might have while building your application. This support service is entirely free, and we encourage you to reach out to us anytime you need help.

How to get all leagues of the sport?

In order to retrieve all the leagues of a particular sport, it's necessary to list all categories first, and then subsequently list all the tournaments within each category. Here's how:

  1. List all Categories: Categories essentially represent the country, tour, or game of the tournaments. Start by fetching all categories via the endpoints: /api/tournament/categories for football, or /api/{sport}/tournament/categories for other sports, where {sport} is a placeholder for the sport in question.
  2. List all Tournaments within each Category: Upon obtaining a response, you can then proceed to fetch all leagues within each category using the endpoint: /api/tournament/all/category/{category_id} for football, or /api/{sport}/tournament/all/category/{category_id} for other sports, with {category_id} being the ID of a specific category.
  3. Get Schedules for each Category: There is an additional functionality that allows you to see events scheduled for a certain day for each category. Use the endpoint: /api/category/{category_id}/events/{day}/{month}/{year} for football, or /api/{sport}/category/{category_id}/events/{day}/{month}/{year} for other sports. Here, {day}, {month}, and {year} are placeholders for the specific day you want to check, with {day} being an integer value.

This way, you can obtain a comprehensive list of leagues and their respective events for any sport. If you encounter any issues or need further assistance, our team is always ready to assist you.

Retrieving All Teams in a League

For obtaining a comprehensive list of all the teams in a specific league, you'll be using our 'standings' endpoints. The process involves:

  1. Standings Endpoint: The standings endpoint is the go-to resource for retrieving data about all teams within a particular league. It provides an array of team data including their current standings, wins, losses, draws, goal difference, and more.

By calling the standings endpoint, you can acquire a detailed snapshot of the teams participating in your selected league, providing a robust foundation for creating rich, interactive experiences around league data.

Should you encounter any difficulties or need further assistance, please don't hesitate to contact our support team. We're here to ensure your API journey is as smooth as possible!

Reasons for Schedule Endpoints Returning Matches from Previous and Next Day

The schedules endpoint is designed to cater to users across various time zones. Thus, to ensure all time zones are covered, we return matches that span 12 hours of the previous day and 12 hours of the next day, relative to GMT/UTC+00. This approach allows us to provide match data that is relevant to users, regardless of their geographical location.

Here's a quick summary from a relevant discussion:

In short, the endpoint returns matches independent of the user’s timezone. You can filter the matches according to your timezone. If you need help doing so, we can assist you.

For a more detailed explanation, please refer to this discussion:

The matches returned by the schedules endpoint are timestamped according to the GMT/UTC+00 timezone. Therefore, to cover all time zones, matches from 12 hours of the previous day and 12 hours of the next day are included in the response.

Don't hesitate to reach out if you require any further clarification or assistance in filtering matches according to your specific timezone. Our team is here to help!

What If the Data I Need Isn't Available?

If you find that the data you're looking for isn't provided by this API, we suggest exploring another API that may better cater to your requirements. We recommend you to consider checking out the Allscores API.

Always remember, our goal is to support your needs, and we are committed to providing the necessary assistance for your development process. If you still have questions or need further information, please feel free to reach out.

Understanding Team Transfer Types

In team transfers, we categorize transfer activities into three types, each representing a different kind of transaction:

  • Type 1: This represents a loan transfer. In this type of transfer, a player is temporarily moved from their current team to another team for a specified period.
  • Type 2: This represents the end of a loan period. At the conclusion of the loan period, the player returns to their original team from the team to which they were loaned.
  • Type 3: This type indicates a permanent transfer where a player is bought or sold between teams. The player permanently changes their team affiliation in these transactions.

These categories allow you to understand the dynamics of team transfers and the nature of the movement of players between teams.