Syntax and relations

How to know what syntax to use? And how can you add additional information about participants (players, coaches, teams etc.)? It’s essential to check the API response to see which model is returned.

Two of the most overlooked nested includes are:

  • players.player β†’ Can be used to include player details on various endpoints.{ID}?api_token=YOUR_TOKEN&include=players.player 
  • β†’ Can be used to include team details on various endpoints.{ID}?api_token=YOUR_TOKEN&

Check the exact relation of the requested entities to determine the syntax.

Player transfers

Let’s say you’re interested in the players from a specific team with all the historical transfers of the player. You can use the Team by ID endpoint with the players include:{ID}?api_token=YOUR_TOKEN&include=players

This request returns a list of player IDs with start and end dates but not the player record. Therefore if you use the players.transfer include, you will only receive the transfer that led the player to the requested team.

If you’re interested in all transfers, you must include the player model first. You can do this by adding the nested include .player:{ID}?api_token=YOUR_TOKEN&include=players.player

Now you can add the transfers include for all the player’s historical transfers.{ID}?api_token=YOUR_TOKEN&include=players.player.transfers

Last updated