{"__v":7,"_id":"564a61684cd0521700523ebf","category":{"__v":6,"_id":"563a4fcaa19edf0d00972321","pages":["563a50051846790d0089535e","564ba1cf5cc43717009bcfe9","565a60d433140c0d0033930c","5673222e47f7010d005bfd7c","56afd2f5d21e9c0d00b62962","56be2bff6cae110d00190c05"],"project":"55773a5ba042551900b002cb","version":"55773a5ba042551900b002ce","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-11-04T18:34:50.832Z","from_sync":false,"order":1,"slug":"guides","title":"Guides"},"parentDoc":null,"project":"55773a5ba042551900b002cb","user":"546d17e2eb9cfd1400dd4529","version":{"__v":17,"_id":"55773a5ba042551900b002ce","project":"55773a5ba042551900b002cb","createdAt":"2015-06-09T19:11:23.764Z","releaseDate":"2015-06-09T19:11:23.764Z","categories":["55773a5ca042551900b002cf","55773a6ce6063e0d00481380","55773ab007e7110d001043ec","55773abaa042551900b002d5","55773ac207e7110d001043ed","55773acb07e7110d001043ee","55773ad3a042551900b002d6","55773adce6063e0d00481383","55773ae4a042551900b002d7","55773af307e7110d001043ef","55773af907e7110d001043f0","55773b0407e7110d001043f1","563a4f7ad25e8919005f3f39","563a4fcaa19edf0d00972321","564a70dc4cd0521700523edf","564b797bcc472d0d00da9435","564b855b766d4923004e1fd1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Motherboard","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-11-16T23:06:16.817Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"This simple guide will walk you through making a simple query to the Statistics API using the [Advanced REST client tool](https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo) for the Chrome browser.\n\nOnce you have installed the tool [launch the application from Chrome ](https://chrome.google.com/webstore/launcher).\n\nNext enter the following URL into the address bar. This query will return the number of top 10 female finishes for each country for the current season.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://api.triathlon.org/v1/statistics/results?analysis=count&filters=position,lte,10|athlete.gender,eq,female&group_by=athlete.country&timeframe=this_year\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nYou will need to provide [authentication information](https://developers.triathlon.org/docs/authentication). To do this simply add a new header with the key of apikey and the value as your personal API key [obtained from the International Triathlon Union](https://developers.triathlon.org/docs/authentication). You may use the form helper provided by the Advanced Rest client tool to generate this header. The following image displays what you should see after completing these two steps (obviously replacing the enter_your_api_key_here with your own personal key).\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ukyVGTufToCOm74gq7mD_rest-client.png\",\n        \"rest-client.png\",\n        \"1090\",\n        \"221\",\n        \"#20315b\",\n        \"\"\n      ],\n      \"caption\": \"Adding query URL and authentication information\"\n    }\n  ]\n}\n[/block]\nThen simply click 'send' and you will obtain a result as per the following example which lists each country (based on [IOC country codes](http://en.wikipedia.org/wiki/List_of_IOC_country_codes)) and the result, which is the number of top 10 finishes each country has had.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n   \\\"code\\\":200,\\n   \\\"status\\\":\\\"success\\\",\\n   \\\"data\\\":[\\n      {\\n         \\\"result\\\":4,\\n         \\\"athlete.country\\\":\\\"AUS\\\"\\n      },\\n      {\\n         \\\"result\\\":1,\\n         \\\"athlete.country\\\":\\\"AUT\\\"\\n      },\\n      {\\n         \\\"result\\\":2,\\n         \\\"athlete.country\\\":\\\"BER\\\"\\n      },\\n      {\\n         \\\"result\\\":1,\\n         \\\"athlete.country\\\":\\\"BRA\\\"\\n      },\\n      {\\n         \\\"result\\\":3,\\n         \\\"athlete.country\\\":\\\"CAN\\\"\\n      },\\n      {\\n         \\\"result\\\":3,\\n         \\\"athlete.country\\\":\\\"CHI\\\"\\n      },\\n      {\\n         \\\"result\\\":1,\\n         \\\"athlete.country\\\":\\\"CZE\\\"\\n      },\\n      {\\n         \\\"result\\\":5,\\n         \\\"athlete.country\\\":\\\"GBR\\\"\\n      },\\n      {\\n         \\\"result\\\":4,\\n         \\\"athlete.country\\\":\\\"GER\\\"\\n      },\\n      {\\n         \\\"result\\\":3,\\n         \\\"athlete.country\\\":\\\"IRL\\\"\\n      },\\n      {\\n         \\\"result\\\":2,\\n         \\\"athlete.country\\\":\\\"JPN\\\"\\n      },\\n      {\\n         \\\"result\\\":2,\\n         \\\"athlete.country\\\":\\\"NED\\\"\\n      },\\n      {\\n         \\\"result\\\":6,\\n         \\\"athlete.country\\\":\\\"NZL\\\"\\n      },\\n      {\\n         \\\"result\\\":1,\\n         \\\"athlete.country\\\":\\\"RSA\\\"\\n      },\\n      {\\n         \\\"result\\\":1,\\n         \\\"athlete.country\\\":\\\"SUI\\\"\\n      },\\n      {\\n         \\\"result\\\":21,\\n         \\\"athlete.country\\\":\\\"USA\\\"\\n      }\\n   ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nIf you are not familiar with [JSON ](http://en.wikipedia.org/wiki/JSON) and would prefer to export the data to a spreadsheet you may use an online tool  to convert the [JSON to CSV](http://konklone.io/json/) which you may then import directly to your favourite spreadsheet program.\n\nNow you have made your first query, check out our [Getting Started](https://developers.triathlon.org/docs/getting-started-with-statistics-api) guide to delve into some more advanced query types and examples.","excerpt":"","slug":"making-your-first-query","type":"basic","title":"Making your First Statistics API Query"}

Making your First Statistics API Query


This simple guide will walk you through making a simple query to the Statistics API using the [Advanced REST client tool](https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo) for the Chrome browser. Once you have installed the tool [launch the application from Chrome ](https://chrome.google.com/webstore/launcher). Next enter the following URL into the address bar. This query will return the number of top 10 female finishes for each country for the current season. [block:code] { "codes": [ { "code": "https://api.triathlon.org/v1/statistics/results?analysis=count&filters=position,lte,10|athlete.gender,eq,female&group_by=athlete.country&timeframe=this_year", "language": "curl" } ] } [/block] You will need to provide [authentication information](https://developers.triathlon.org/docs/authentication). To do this simply add a new header with the key of apikey and the value as your personal API key [obtained from the International Triathlon Union](https://developers.triathlon.org/docs/authentication). You may use the form helper provided by the Advanced Rest client tool to generate this header. The following image displays what you should see after completing these two steps (obviously replacing the enter_your_api_key_here with your own personal key). [block:image] { "images": [ { "image": [ "https://files.readme.io/ukyVGTufToCOm74gq7mD_rest-client.png", "rest-client.png", "1090", "221", "#20315b", "" ], "caption": "Adding query URL and authentication information" } ] } [/block] Then simply click 'send' and you will obtain a result as per the following example which lists each country (based on [IOC country codes](http://en.wikipedia.org/wiki/List_of_IOC_country_codes)) and the result, which is the number of top 10 finishes each country has had. [block:code] { "codes": [ { "code": "{\n \"code\":200,\n \"status\":\"success\",\n \"data\":[\n {\n \"result\":4,\n \"athlete.country\":\"AUS\"\n },\n {\n \"result\":1,\n \"athlete.country\":\"AUT\"\n },\n {\n \"result\":2,\n \"athlete.country\":\"BER\"\n },\n {\n \"result\":1,\n \"athlete.country\":\"BRA\"\n },\n {\n \"result\":3,\n \"athlete.country\":\"CAN\"\n },\n {\n \"result\":3,\n \"athlete.country\":\"CHI\"\n },\n {\n \"result\":1,\n \"athlete.country\":\"CZE\"\n },\n {\n \"result\":5,\n \"athlete.country\":\"GBR\"\n },\n {\n \"result\":4,\n \"athlete.country\":\"GER\"\n },\n {\n \"result\":3,\n \"athlete.country\":\"IRL\"\n },\n {\n \"result\":2,\n \"athlete.country\":\"JPN\"\n },\n {\n \"result\":2,\n \"athlete.country\":\"NED\"\n },\n {\n \"result\":6,\n \"athlete.country\":\"NZL\"\n },\n {\n \"result\":1,\n \"athlete.country\":\"RSA\"\n },\n {\n \"result\":1,\n \"athlete.country\":\"SUI\"\n },\n {\n \"result\":21,\n \"athlete.country\":\"USA\"\n }\n ]\n}", "language": "json" } ] } [/block] If you are not familiar with [JSON ](http://en.wikipedia.org/wiki/JSON) and would prefer to export the data to a spreadsheet you may use an online tool to convert the [JSON to CSV](http://konklone.io/json/) which you may then import directly to your favourite spreadsheet program. Now you have made your first query, check out our [Getting Started](https://developers.triathlon.org/docs/getting-started-with-statistics-api) guide to delve into some more advanced query types and examples.