{"_id":"564a678beed7de0d003671dc","__v":1,"user":{"_id":"546d17e2eb9cfd1400dd4529","username":"","name":"World Triathlon"},"initVersion":{"_id":"55773a5ba042551900b002ce","version":"1"},"project":"55773a5ba042551900b002cb","tags":[],"createdAt":"2015-06-16T04:24:00.000Z","changelog":[{"_id":"564a6858c58bef0d006206be","update":"Matchup endpoint at /statistics/matchups","type":"added"},{"_id":"564a6858c58bef0d006206bd","update":"","type":"added"}],"body":"We have added a new [Matchup endpoint](http://statistics.triathlon.org/v1.0/docs/matchups) to the Statistics API. The purpose of this endpoint is to determine the relative performances of a group of athletes, comparing events where they have raced each other. For a simple example, we can see the rivalry of Alistair and Jonathan Brownlee by making the following query:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --header \\\"apikey: [[app:key]]\\\" \\\"https://api.triathlon.org/v1/statistics/matchups?athletes=athlete.name,in,Alistair%20Brownlee,Jonathan%20Brownlee\\\"\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nA curtailed response is shown below (there is much more detail in the [actual response](http://statistics.triathlon.org/v1.0/docs/matchups)). From the response we can quickly see that the pair have raced each other 20 times over the course of the Series with Alistair finishing ahead of Jonathan in those races 14 times.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Actual Response Contains More Data\",\n  \"body\": \"The [actual response](http://statistics.triathlon.org/v1.0/docs/matchups) also contains a matchup_results object that describes each of the results in detail that may be used for presentation or in further analysis. Using the matchup_results object it is also trivial to find the first time and last time the matchup occurred.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n   \\\"code\\\":200,\\n   \\\"status\\\":\\\"success\\\",\\n   \\\"data\\\":{\\n      \\\"total_matchups\\\":20,\\n      \\\"athletes\\\":[\\n         {\\n            \\\"wins\\\":14,\\n            \\\"losses\\\":6,\\n            \\\"no_results\\\":0,\\n            \\\"athlete_title\\\":\\\"Alistair Brownlee\\\",\\n            \\\"athlete_age\\\":27,\\n            \\\"athlete_country\\\":\\\"GBR\\\",\\n            \\\"wts_ranking\\\":5,\\n            \\\"wts_starts\\\":29,\\n            \\\"wts_wins\\\":19,\\n            \\\"wts_podiums\\\":23\\n         },\\n         {\\n            \\\"wins\\\":6,\\n            \\\"losses\\\":14,\\n            \\\"no_results\\\":0,\\n            \\\"athlete_title\\\":\\\"Jonathan Brownlee\\\",\\n            \\\"athlete_age\\\":25,\\n            \\\"athlete_country\\\":\\\"GBR\\\",\\n            \\\"wts_ranking\\\":7,\\n            \\\"wts_starts\\\":30,\\n            \\\"wts_wins\\\":10,\\n            \\\"wts_podiums\\\":22,\\n         }\\n      ]\\n   }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Adding Filters\"\n}\n[/block]\nThrough the use of filters we can further break down this analysis by applying the [relevant filters](http://statistics.triathlon.org/v1.0/docs#filters) to match the event criteria we are interested in. Continuing our above example we would like to know the matchup result between the Brownlee brothers over the Sprint distance. The following query yields that result:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --header \\\"apikey: [[app:key]]\\\" \\\"https://api.triathlon.org/v1/statistics/matchups?athletes=athlete.name,in,Alistair%20Brownlee,Jonathan%20Brownlee&filters=format,eq,Sprint\\\"\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nThe result, again curtailed for brevity, shows that they have raced each other 6 times over the Sprint distance with the head-to-head matchup standing at 3 wins apiece.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n   \\\"code\\\":200,\\n   \\\"status\\\":\\\"success\\\",\\n   \\\"data\\\":{\\n      \\\"total_matchups\\\":6,\\n      \\\"athletes\\\":[\\n         {\\n            \\\"wins\\\":3,\\n            \\\"losses\\\":3,\\n            \\\"no_results\\\":0,\\n            \\\"athlete_title\\\":\\\"Alistair Brownlee\\\"\\n         },\\n         {\\n            \\\"wins\\\":3,\\n            \\\"losses\\\":3,\\n            \\\"no_results\\\":0,\\n            \\\"athlete_title\\\":\\\"Jonathan Brownlee\\\",\\n         }\\n      ]\\n   }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nYou may combine multiple filters to further restrict the events used in the analysis. For example the following query builds on the previous example by only including Standard distance races where wetsuits were used.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --header \\\"apikey: [[app:key]]\\\" \\\"https://api.triathlon.org/v1/statistics/matchups?athletes=athlete.name,in,Alistair%20Brownlee,Jonathan%20Brownlee&filters=format,eq,Standard|program.wetsuit,eq,true\\\"\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"All Properties Available\",\n  \"body\": \"All properties are available for use in filters as are listed on the [Results endpoint property table](http://statistics.triathlon.org/v1.0/docs/results).\"\n}\n[/block]\nThe following example displays the results of the Brownlee matchup for events in London:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --header \\\"apikey: [[app:key]]\\\" \\\"https://api.triathlon.org/v1/statistics/matchups?athletes=athlete.name,in,Alistair%20Brownlee,Jonathan%20Brownlee&filters=event.name,contains,London\\\"\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Athlete Groupings\"\n}\n[/block]\nYou may pass as many athletes as you wish into the Matchups endpoint with a *win* being determined as finishing ahead of all other athletes in the group. For example, the following example lists the matchup of Jonathan Brownlee, Mario Mola and Richard Murray over the Sprint distance.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --header \\\"apikey: [[app:key]]\\\" \\\"https://api.triathlon.org/v1/statistics/matchups?athletes=athlete.name,in,Jonathan%20Brownlee,Mario%20Mola,Richard%20Murray&filters=format,eq,Sprint\\\"\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nThe response (again only partially shown) shows this specific matchup has occurred 7 times in Series history with Jonathan Brownlee leading this group of athletes 4 times, Mario twice and Richard Murray once. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n   \\\"code\\\":200,\\n   \\\"status\\\":\\\"success\\\",\\n   \\\"data\\\":{\\n      \\\"total_matchups\\\":7,\\n      \\\"athletes\\\":[\\n         {\\n            \\\"wins\\\":4,\\n            \\\"losses\\\":3,\\n            \\\"athlete_title\\\":\\\"Jonathan Brownlee\\\",\\n         },\\n         {\\n            \\\"wins\\\":2,\\n            \\\"losses\\\":5,\\n            \\\"athlete_title\\\":\\\"Mario Mola\\\",\\n         },\\n         {\\n            \\\"wins\\\":1,\\n            \\\"losses\\\":6,\\n            \\\"athlete_title\\\":\\\"Richard Murray\\\",\\n         }\\n      ]\\n   }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","slug":"matchup-endpoint","title":"Matchup Endpoint"}

Matchup Endpoint


We have added a new [Matchup endpoint](http://statistics.triathlon.org/v1.0/docs/matchups) to the Statistics API. The purpose of this endpoint is to determine the relative performances of a group of athletes, comparing events where they have raced each other. For a simple example, we can see the rivalry of Alistair and Jonathan Brownlee by making the following query: [block:code] { "codes": [ { "code": "curl --header \"apikey: [[app:key]]\" \"https://api.triathlon.org/v1/statistics/matchups?athletes=athlete.name,in,Alistair%20Brownlee,Jonathan%20Brownlee\"", "language": "curl" } ] } [/block] A curtailed response is shown below (there is much more detail in the [actual response](http://statistics.triathlon.org/v1.0/docs/matchups)). From the response we can quickly see that the pair have raced each other 20 times over the course of the Series with Alistair finishing ahead of Jonathan in those races 14 times. [block:callout] { "type": "warning", "title": "Actual Response Contains More Data", "body": "The [actual response](http://statistics.triathlon.org/v1.0/docs/matchups) also contains a matchup_results object that describes each of the results in detail that may be used for presentation or in further analysis. Using the matchup_results object it is also trivial to find the first time and last time the matchup occurred." } [/block] [block:code] { "codes": [ { "code": "{\n \"code\":200,\n \"status\":\"success\",\n \"data\":{\n \"total_matchups\":20,\n \"athletes\":[\n {\n \"wins\":14,\n \"losses\":6,\n \"no_results\":0,\n \"athlete_title\":\"Alistair Brownlee\",\n \"athlete_age\":27,\n \"athlete_country\":\"GBR\",\n \"wts_ranking\":5,\n \"wts_starts\":29,\n \"wts_wins\":19,\n \"wts_podiums\":23\n },\n {\n \"wins\":6,\n \"losses\":14,\n \"no_results\":0,\n \"athlete_title\":\"Jonathan Brownlee\",\n \"athlete_age\":25,\n \"athlete_country\":\"GBR\",\n \"wts_ranking\":7,\n \"wts_starts\":30,\n \"wts_wins\":10,\n \"wts_podiums\":22,\n }\n ]\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Adding Filters" } [/block] Through the use of filters we can further break down this analysis by applying the [relevant filters](http://statistics.triathlon.org/v1.0/docs#filters) to match the event criteria we are interested in. Continuing our above example we would like to know the matchup result between the Brownlee brothers over the Sprint distance. The following query yields that result: [block:code] { "codes": [ { "code": "curl --header \"apikey: [[app:key]]\" \"https://api.triathlon.org/v1/statistics/matchups?athletes=athlete.name,in,Alistair%20Brownlee,Jonathan%20Brownlee&filters=format,eq,Sprint\"", "language": "curl" } ] } [/block] The result, again curtailed for brevity, shows that they have raced each other 6 times over the Sprint distance with the head-to-head matchup standing at 3 wins apiece. [block:code] { "codes": [ { "code": "{\n \"code\":200,\n \"status\":\"success\",\n \"data\":{\n \"total_matchups\":6,\n \"athletes\":[\n {\n \"wins\":3,\n \"losses\":3,\n \"no_results\":0,\n \"athlete_title\":\"Alistair Brownlee\"\n },\n {\n \"wins\":3,\n \"losses\":3,\n \"no_results\":0,\n \"athlete_title\":\"Jonathan Brownlee\",\n }\n ]\n }\n}", "language": "json" } ] } [/block] You may combine multiple filters to further restrict the events used in the analysis. For example the following query builds on the previous example by only including Standard distance races where wetsuits were used. [block:code] { "codes": [ { "code": "curl --header \"apikey: [[app:key]]\" \"https://api.triathlon.org/v1/statistics/matchups?athletes=athlete.name,in,Alistair%20Brownlee,Jonathan%20Brownlee&filters=format,eq,Standard|program.wetsuit,eq,true\"", "language": "curl" } ] } [/block] [block:callout] { "type": "warning", "title": "All Properties Available", "body": "All properties are available for use in filters as are listed on the [Results endpoint property table](http://statistics.triathlon.org/v1.0/docs/results)." } [/block] The following example displays the results of the Brownlee matchup for events in London: [block:code] { "codes": [ { "code": "curl --header \"apikey: [[app:key]]\" \"https://api.triathlon.org/v1/statistics/matchups?athletes=athlete.name,in,Alistair%20Brownlee,Jonathan%20Brownlee&filters=event.name,contains,London\"", "language": "curl" } ] } [/block] [block:api-header] { "type": "basic", "title": "Athlete Groupings" } [/block] You may pass as many athletes as you wish into the Matchups endpoint with a *win* being determined as finishing ahead of all other athletes in the group. For example, the following example lists the matchup of Jonathan Brownlee, Mario Mola and Richard Murray over the Sprint distance. [block:code] { "codes": [ { "code": "curl --header \"apikey: [[app:key]]\" \"https://api.triathlon.org/v1/statistics/matchups?athletes=athlete.name,in,Jonathan%20Brownlee,Mario%20Mola,Richard%20Murray&filters=format,eq,Sprint\"", "language": "curl" } ] } [/block] The response (again only partially shown) shows this specific matchup has occurred 7 times in Series history with Jonathan Brownlee leading this group of athletes 4 times, Mario twice and Richard Murray once. [block:code] { "codes": [ { "code": "{\n \"code\":200,\n \"status\":\"success\",\n \"data\":{\n \"total_matchups\":7,\n \"athletes\":[\n {\n \"wins\":4,\n \"losses\":3,\n \"athlete_title\":\"Jonathan Brownlee\",\n },\n {\n \"wins\":2,\n \"losses\":5,\n \"athlete_title\":\"Mario Mola\",\n },\n {\n \"wins\":1,\n \"losses\":6,\n \"athlete_title\":\"Richard Murray\",\n }\n ]\n }\n}", "language": "json" } ] } [/block]
added
Matchup endpoint at /statistics/matchups