Request and Response Structure

Let's look at the generic request and response structure for the endpoints.

Request structure

The request of an API-Football endpoint contains a header and an endpoint.

Header structure

The header contains two elements:

  • x-rapidapi-host is either v3.football.api-sports.io or api-football-v1.p.rapidapi.com, depending on the platform you have signed up with. In our case, it will be v3.football.api-sports.io since we signed up using the API-Football website.
  • x-rapidapi-key is the API key of the user.

Endpoint structure

The endpoint consists of the base URI and query parameters, depending on the endpoint the user is trying to access. We will look at these base URIs and the query parameters in the upcoming lessons.

Response structure

The response contains a header and a JSON response object.

Header structure

The header contains four elements:

  • x-ratelimit-requests-limit tells the user about the number of requests allocated per day according to our subscription.

  • x-ratelimit-requests-remaining provides information about the number of remaining requests per day according to our subscription.

  • X-RateLimit-Limit contains the maximum number of API calls per minute.

  • X-RateLimit-Remaining tells the user about the number of API calls remaining before reaching the limit per minute.

The JSON response

The JSON element of the response provides the user with the required information for which the endpoint was called. The information is different for different endpoints. We will look at the response parameters for each endpoint in the upcoming lessons.

The user may receive an error message in the response which will look like this:

Get hands-on with 1400+ tech skills courses.