{"_id":"564b86a0e6c67c2f0038366e","editedParams2":true,"project":"55773a5ba042551900b002cb","version":{"_id":"55773a5ba042551900b002ce","project":"55773a5ba042551900b002cb","__v":17,"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"},"__v":7,"parentDoc":null,"category":{"_id":"564a70dc4cd0521700523edf","__v":3,"version":"55773a5ba042551900b002ce","pages":["564b868fdda79a19000f2679","564b86a0e6c67c2f0038366e","56b4dc1e3d5f130d00dad161"],"project":"55773a5ba042551900b002cb","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-11-17T00:12:12.009Z","from_sync":false,"order":12,"slug":"search-api","title":"Search API"},"editedParams":true,"user":"546d17e2eb9cfd1400dd4529","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-11-17T19:57:20.921Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"method":"get","results":{"codes":[{"name":"Federation Search Listing","code":"{\n   \"code\":200,\n   \"status\":\"success\",\n   \"total\":2,\n   \"per_page\":10,\n   \"current_page\":1,\n   \"last_page\":1,\n   \"next_page_url\":null,\n   \"prev_page_url\":null,\n   \"from\":1,\n   \"to\":2,\n   \"data\":[\n      {\n         \"federation_id\":2356,\n         \"federation_title\":\"British Triathlon Federation\",\n         \"federation_slug\":\"british_triathlon_federation\",\n         \"federation_edit_date\":\"2016-01-06T17:42:35+00:00\",\n         \"federation_country_id\":292,\n         \"federation_region_id\":10,\n         \"federation_region_name\":\"Europe\",\n         \"federation_affiliation_status\":\"Affiliated\",\n         \"federation_noc\":\"GBR\",\n         \"federation_country_name\":\"Great Britain\",\n         \"federation_country_isoa2\":\"GB\",\n         \"federation_flag\":\"https:\\/\\/f9ca11ef49c28681fc01-0acbf57e00c47a50e70a1acb89e86c89.ssl.cf1.rackcdn.com\\/images\\/icons\\/gb.png\",\n         \"federation_listing\":\"http:\\/\\/www.triathlon.org\\/federations\\/federation\\/british_triathlon_federation\",\n         \"federation_api_listing\":\"https:\\/\\/api.triathlon.org\\/v1\\/v1\\/federations\\/2356\"\n      },\n      {\n         \"federation_id\":34272,\n         \"federation_title\":\"British Virgin Islands Federation\",\n         \"federation_slug\":\"bvi_triathlon_federation\",\n         \"federation_edit_date\":\"2015-07-07T21:28:03+00:00\",\n         \"federation_country_id\":128,\n         \"federation_region_id\":11,\n         \"federation_region_name\":\"Americas\",\n         \"federation_affiliation_status\":\"Affiliated\",\n         \"federation_noc\":\"IVB\",\n         \"federation_country_name\":\"British Virgin Islands\",\n         \"federation_country_isoa2\":\"VG\",\n         \"federation_flag\":\"https:\\/\\/f9ca11ef49c28681fc01-0acbf57e00c47a50e70a1acb89e86c89.ssl.cf1.rackcdn.com\\/images\\/icons\\/vg.png\",\n         \"federation_listing\":\"http:\\/\\/www.triathlon.org\\/federations\\/federation\\/bvi_triathlon_federation\",\n         \"federation_api_listing\":\"https:\\/\\/api.triathlon.org\\/v1\\/v1\\/federations\\/34272\"\n      }\n   ]\n}","language":"json","status":200}]},"settings":"","auth":"required","params":[{"_id":"572242d41bfc8a0e00bcd643","ref":"","in":"query","required":false,"desc":"","default":"","type":"int","name":"page"},{"_id":"572242d41bfc8a0e00bcd642","ref":"","in":"query","required":false,"desc":"","default":"","type":"int","name":"per_page"},{"_id":"565ce3f5b311ea0d00a383f8","ref":"","in":"path","required":true,"desc":"A collection to search","default":"","type":"string","name":"collection"},{"_id":"56abd2cdf9757e0d007c6659","ref":"","in":"query","required":false,"desc":"A search term to query","default":"","type":"string","name":"query"},{"_id":"56b0f860ce5f410d0056ca0f","ref":"","in":"query","required":false,"desc":"A pipe delimited list of filters","default":"","type":"string","name":"filters"},{"_id":"56b0f860ce5f410d0056ca0e","ref":"","in":"query","required":false,"desc":"A lat/long value from where to center the search","default":"","type":"string","name":"location"},{"_id":"56cf518c8629f91300fd97a8","ref":"","in":"query","required":false,"desc":"The distance in km around a provided location","default":"","type":"int","name":"distance"},{"_id":"56cf51e26c5d7a13005ee8b6","ref":"","in":"query","required":false,"desc":"The start date to filter results","default":"","type":"yyyy-mm-dd","name":"start_date"},{"_id":"56cf51e26c5d7a13005ee8b5","ref":"","in":"query","required":false,"desc":"The end date to filter entries","default":"","type":"yyyy-mm-dd","name":"end_date"},{"_id":"56cfdda88629f91300fd98d0","ref":"","in":"query","required":false,"desc":"For athletes collection restrict to elite only athletes","default":"","type":"boolean","name":"elite"}],"url":"/search/:collection"},"isReference":true,"order":1,"body":"The **Results** method searches a specified collection and returns a corresponding basic object for each. See the [Search API overview](https://developers.triathlon.org/docs/search-api-overview) for a listing of all collections.\n\nThe `query` parameter performs a fuzzy search on a number of different parameters, e.g. for the athletes index a search for *Brownlee* will search the article title, article excerpt and associated tags.\n\nIf you wish to search multiple collections for the best possible user experience it is suggested that you make, and present, individual queries of the separate collections such that you can set the parameters on each accordingly. \n[block:callout]\n{\n  \"type\": \"danger\",\n  \"body\": \"We don’t recommend to merge the results of several queries in a single results list because their ranking criteria are often non-comparable: rather display them in separated sections.\"\n}\n[/block]\nYou may apply additional [filters](https://developers.triathlon.org/docs/search-api-overview#filters), [dates](https://developers.triathlon.org/docs/search-api-overview#dates) and [geo-searching](https://developers.triathlon.org/docs/search-api-overview#geo-searching) parameters to your queries to refine search results.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Examples\"\n}\n[/block]\nFind all athletes with *Gwen* in their name.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --header \\\"apikey: [[app:key]]\\\" \\\"https://api.triathlon.org/v1/search/athletes?query=gwen\\\"\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nRestrict an athlete search to elite only athletes (those athletes with a current points list ranking).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --header \\\"apikey: [[app:key]]\\\" \\\"https://api.triathlon.org/v1/search/athletes?filters=athlete_gender,male|elite,true\\\"\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nList events that are closest to a certain location (to find events in the future add an applicable `start_date`).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --header \\\"apikey: [[app:key]]\\\" \\\"https://api.triathlon.org/v1/search/events?location=49.246292,-123.116226\\\"\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"search-results","type":"endpoint","title":"Results"}

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

collection:
required
string
A collection to search

Query Params

page:
integer
per_page:
integer
query:
string
A search term to query
filters:
string
A pipe delimited list of filters
location:
string
A lat/long value from where to center the search
distance:
integer
The distance in km around a provided location
start_date:
yyyy-mm-dd
The start date to filter results
end_date:
yyyy-mm-dd
The end date to filter entries
elite:
boolean
For athletes collection restrict to elite only athletes

Result Format


Documentation

The **Results** method searches a specified collection and returns a corresponding basic object for each. See the [Search API overview](https://developers.triathlon.org/docs/search-api-overview) for a listing of all collections. The `query` parameter performs a fuzzy search on a number of different parameters, e.g. for the athletes index a search for *Brownlee* will search the article title, article excerpt and associated tags. If you wish to search multiple collections for the best possible user experience it is suggested that you make, and present, individual queries of the separate collections such that you can set the parameters on each accordingly. [block:callout] { "type": "danger", "body": "We don’t recommend to merge the results of several queries in a single results list because their ranking criteria are often non-comparable: rather display them in separated sections." } [/block] You may apply additional [filters](https://developers.triathlon.org/docs/search-api-overview#filters), [dates](https://developers.triathlon.org/docs/search-api-overview#dates) and [geo-searching](https://developers.triathlon.org/docs/search-api-overview#geo-searching) parameters to your queries to refine search results. [block:api-header] { "type": "basic", "title": "Examples" } [/block] Find all athletes with *Gwen* in their name. [block:code] { "codes": [ { "code": "curl --header \"apikey: [[app:key]]\" \"https://api.triathlon.org/v1/search/athletes?query=gwen\"", "language": "json" } ] } [/block] Restrict an athlete search to elite only athletes (those athletes with a current points list ranking). [block:code] { "codes": [ { "code": "curl --header \"apikey: [[app:key]]\" \"https://api.triathlon.org/v1/search/athletes?filters=athlete_gender,male|elite,true\"", "language": "json" } ] } [/block] List events that are closest to a certain location (to find events in the future add an applicable `start_date`). [block:code] { "codes": [ { "code": "curl --header \"apikey: [[app:key]]\" \"https://api.triathlon.org/v1/search/events?location=49.246292,-123.116226\"", "language": "json" } ] } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}