getRaceResults
GraphQL query to display race results.
getRaceResults
POST
https://zed-ql.zed.run/graphql
This endpoint allows you to get race results filtered by: • location (country, city) • dates (from, to) • distance (from, to) • classes • boolean flag onlyMyRacehorses
Headers
x-developer-secret
string
Please see the link below.
Content-Type
string
application/json
{
"data": {
"getRaceResults": {
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjA=",
"node": {
"city": "Perugia",
"class": 2,
"country": "Italy",
"fee": "0.0",
"horses": [
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 2,
"coat": "Chartreuse",
"finalPosition": "9",
"finishTime": 107.664,
"gate": "8",
"gen": "Z10",
"gender": "Colt",
"hexColor": "7FFF00",
"horseId": 9609,
"imgUrl": "https://img.zed.run/horses/7FFF00.svg",
"name": "Crazy Dream",
"ownerAddress": "0x958Ea35817C7cfbb216174486800dFA8F3024BE7",
"stableName": "Aloha Racing"
},
{
"bloodline": "Szabo",
"breedType": "legendary",
"class": 3,
"coat": "Oval Orchid",
"finalPosition": "3",
"finishTime": 106.692,
"gate": "12",
"gen": "Z8",
"gender": "Mare",
"hexColor": "DA70D6",
"horseId": 6670,
"imgUrl": "https://img.zed.run/horses/DA70D6.svg",
"name": "Tiger_Roll",
"ownerAddress": "0x0680cC6a4d7F7b9A3c3f584eF2d5DF04d6931c32",
"stableName": "₿ Moon Mission"
},
{
"bloodline": "Nakamoto",
"breedType": "exclusive",
"class": 3,
"coat": "Electric Violet",
"finalPosition": "8",
"finishTime": 107.3864,
"gate": "9",
"gen": "Z3",
"gender": "Filly",
"hexColor": "8F00FF",
"horseId": 8319,
"imgUrl": "https://img.zed.run/horses/8F00FF.svg",
"name": "Sky Lynx",
"ownerAddress": "0x260747CEFB9453F0c48fc36cee216EA996b82F94",
"stableName": "Secure Digital"
},
{
"bloodline": "Nakamoto",
"breedType": "exclusive",
"class": 2,
"coat": "Ghost White",
"finalPosition": "7",
"finishTime": 107.2254,
"gate": "3",
"gen": "Z3",
"gender": "Mare",
"hexColor": "FFFFFF",
"horseId": 6533,
"imgUrl": "https://img.zed.run/horses/FFFFFF.svg",
"name": "Blitzkrieg",
"ownerAddress": "0xE966C1E81B70920293C123C81994ef5fc19f8D35",
"stableName": "KUDA STABLE"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 5,
"coat": "Rosy Brown",
"finalPosition": "5",
"finishTime": 107.0768,
"gate": "6",
"gen": "Z9",
"gender": "Filly",
"hexColor": "BC8F8F",
"horseId": 4026,
"imgUrl": "https://img.zed.run/horses/BC8F8F.svg",
"name": "Terrazzo",
"ownerAddress": "0x5697336651A2Caf8A4772301aaF19cd93d0511BE",
"stableName": "Lady Boss"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 4,
"coat": "Alabaster",
"finalPosition": "10",
"finishTime": 107.6694,
"gate": "11",
"gen": "Z10",
"gender": "Colt",
"hexColor": "F2F0E6",
"horseId": 11709,
"imgUrl": "https://img.zed.run/horses/F2F0E6.svg",
"name": "Come By Chance",
"ownerAddress": "0x3ED70d502D9feb8be9d2e4bd8713d4F55E6DC2Ef",
"stableName": "Aux noms d'Or"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 3,
"coat": "Azure",
"finalPosition": "6",
"finishTime": 107.2243,
"gate": "10",
"gen": "Z10",
"gender": "Filly",
"hexColor": "007FFF",
"horseId": 11007,
"imgUrl": "https://img.zed.run/horses/007FFF.svg",
"name": "Marital",
"ownerAddress": "0x157b1c8C3De55B87be545B3DBc9D17f06F0112F8",
"stableName": "Totoshe"
},
{
"bloodline": "Finney",
"breedType": "genesis",
"class": 2,
"coat": "Space Sparkle",
"finalPosition": "1",
"finishTime": 105.9995,
"gate": "1",
"gen": "Z6",
"gender": "Colt",
"hexColor": "4A646C",
"horseId": 10924,
"imgUrl": "https://img.zed.run/horses/4A646C.svg",
"name": "Hunters Madness",
"ownerAddress": "0x8A5AFB1233f7aFe089EfDCC8F5538d6753e26ad9",
"stableName": "Shadow Stable"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 5,
"coat": "Pale Violet",
"finalPosition": "12",
"finishTime": 107.7833,
"gate": "2",
"gen": "Z9",
"gender": "Colt",
"hexColor": "DB7093",
"horseId": 11157,
"imgUrl": "https://img.zed.run/horses/DB7093.svg",
"name": "Wild Naturally",
"ownerAddress": "0x11d199eDA53173A9055C3DA86f45CB78e6106440",
"stableName": "Make$It$Rain"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 4,
"coat": "Champagne Papi",
"finalPosition": "4",
"finishTime": 106.9278,
"gate": "5",
"gen": "Z10",
"gender": "Filly",
"hexColor": "F1DDCF",
"horseId": 10649,
"imgUrl": "https://img.zed.run/horses/F1DDCF.svg",
"name": "Boss In The Game",
"ownerAddress": "0x08a3a8Ea83198dEceAd437c4077789b340D07032",
"stableName": "Dratini"
},
{
"bloodline": "Szabo",
"breedType": "legendary",
"class": 1,
"coat": "Fandango",
"finalPosition": "2",
"finishTime": 106.681,
"gate": "7",
"gen": "Z5",
"gender": "Stallion",
"hexColor": "B53389",
"horseId": 11146,
"imgUrl": "https://img.zed.run/horses/B53389.svg",
"name": "I'm A Ducky On The Edge",
"ownerAddress": "0x8ddC79980651c394400D5E8A4112868A2ec522bb",
"stableName": "Doofy Racing"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 5,
"coat": "Dark Byzantium",
"finalPosition": "11",
"finishTime": 107.778,
"gate": "4",
"gen": "Z10",
"gender": "Colt",
"hexColor": "5D3954",
"horseId": 11658,
"imgUrl": "https://img.zed.run/horses/5D3954.svg",
"name": "Times Square",
"ownerAddress": "0x931C9818A8d84fA031bb6F65A244280C45121085",
"stableName": "Morning Dew Stables"
}
],
"length": 1800,
"name": "Italian Guineas",
"prizePool": {
"first": "1680000000000000",
"second": "700000000000000",
"third": "420000000000000"
},
"raceId": "J57gYqMi",
"startTime": "2021-02-16T02:20:00",
"status": "finished",
"weather": "Sunny"
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"city": "Olinda",
"class": 5,
"country": "Brazil",
"fee": "0.0",
"horses": [
{
"bloodline": "Buterin",
"breedType": "pacer",
"class": 5,
"coat": "Absolute Zero",
"finalPosition": "9",
"finishTime": 146.6228,
"gate": "2",
"gen": "Z45",
"gender": "Colt",
"hexColor": "0048BA",
"horseId": 8241,
"imgUrl": "https://img.zed.run/horses/0048BA.svg",
"name": "BlueStreak",
"ownerAddress": "0x260747CEFB9453F0c48fc36cee216EA996b82F94",
"stableName": "Secure Digital"
},
{
"bloodline": "Buterin",
"breedType": "legendary",
"class": 5,
"coat": "Absolute Zero",
"finalPosition": "1",
"finishTime": 143.0366,
"gate": "8",
"gen": "Z18",
"gender": "Colt",
"hexColor": "0048BA",
"horseId": 9800,
"imgUrl": "https://img.zed.run/horses/0048BA.svg",
"name": "Dodge",
"ownerAddress": "0x28FC104755Cee05cB1B62C8385d105D692B5563E",
"stableName": "SLONGS"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 5,
"coat": "Big Dip O’Ruby",
"finalPosition": "11",
"finishTime": 147.0784,
"gate": "7",
"gen": "Z9",
"gender": "Colt",
"hexColor": "9C2542",
"horseId": 10870,
"imgUrl": "https://img.zed.run/horses/9C2542.svg",
"name": "Casual Smile",
"ownerAddress": "0x08a3a8Ea83198dEceAd437c4077789b340D07032",
"stableName": "Dratini"
},
{
"bloodline": "Buterin",
"breedType": "pacer",
"class": 5,
"coat": "Bittersweet Shimmer",
"finalPosition": "12",
"finishTime": 148.2224,
"gate": "5",
"gen": "Z56",
"gender": "Colt",
"hexColor": "BF4F51",
"horseId": 10253,
"imgUrl": "https://img.zed.run/horses/BF4F51.svg",
"name": "Proverbs'",
"ownerAddress": "0x96D286D6280455EDe2A2ca412D4ba796AB5e5156",
"stableName": "⚛ϓϊρɦ₸âçĥ 🏆 Ŕãçϊɳĝ*"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 5,
"coat": "Copper Penny",
"finalPosition": "3",
"finishTime": 144.9608,
"gate": "10",
"gen": "Z9",
"gender": "Filly",
"hexColor": "AD6F69",
"horseId": 11395,
"imgUrl": "https://img.zed.run/horses/AD6F69.svg",
"name": "Sword of Art",
"ownerAddress": "0xeA2765E6E0d3e27f7D7ebe52b1fd3E9f6C5be8C1",
"stableName": "Emerald Ranch"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 5,
"coat": "Champagne Papi",
"finalPosition": "4",
"finishTime": 145.1731,
"gate": "1",
"gen": "Z10",
"gender": "Colt",
"hexColor": "F1DDCF",
"horseId": 11194,
"imgUrl": "https://img.zed.run/horses/F1DDCF.svg",
"name": "Bro Code",
"ownerAddress": "0x11d199eDA53173A9055C3DA86f45CB78e6106440",
"stableName": "Make$It$Rain"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 5,
"coat": "Burnt Sienna",
"finalPosition": "8",
"finishTime": 146.5508,
"gate": "12",
"gen": "Z9",
"gender": "Colt",
"hexColor": "E97451",
"horseId": 10570,
"imgUrl": "https://img.zed.run/horses/E97451.svg",
"name": "Smooth Boss",
"ownerAddress": "0x0680cC6a4d7F7b9A3c3f584eF2d5DF04d6931c32",
"stableName": "₿ Moon Mission"
},
{
"bloodline": "Buterin",
"breedType": "elite",
"class": 5,
"coat": "Cinereous",
"finalPosition": "7",
"finishTime": 146.2491,
"gate": "9",
"gen": "Z24",
"gender": "Filly",
"hexColor": "98817B",
"horseId": 7245,
"imgUrl": "https://img.zed.run/horses/98817B.svg",
"name": "Bugs Bunny",
"ownerAddress": "0x26dC85D85c7249ea9449020A7109A28f599b1746",
"stableName": "⇜ÐΛ℟₭ F҉ Ï℟€ Λ₵℟€Ꮥ⇝"
},
{
"bloodline": "Buterin",
"breedType": "legendary",
"class": 5,
"coat": "Firebrick",
"finalPosition": "2",
"finishTime": 144.1881,
"gate": "11",
"gen": "Z12",
"gender": "Colt",
"hexColor": "B22222",
"horseId": 10821,
"imgUrl": "https://img.zed.run/horses/B22222.svg",
"name": "The Trouble Maker",
"ownerAddress": "0xE966C1E81B70920293C123C81994ef5fc19f8D35",
"stableName": "KUDA STABLE"
},
{
"bloodline": "Buterin",
"breedType": "genesis",
"class": 5,
"coat": "Cyclamen",
"finalPosition": "5",
"finishTime": 145.4186,
"gate": "4",
"gen": "Z10",
"gender": "Colt",
"hexColor": "F56FA1",
"horseId": 11234,
"imgUrl": "https://img.zed.run/horses/F56FA1.svg",
"name": "Excellent Rhythm",
"ownerAddress": "0x65037Ca39E04fC61928d3FdAf2F65E4DfBbc8C42",
"stableName": "Stable Jenius"
},
{
"bloodline": "Buterin",
"breedType": "legendary",
"class": 5,
"coat": "Big Dip O’Ruby",
"finalPosition": "6",
"finishTime": 145.5193,
"gate": "3",
"gen": "Z16",
"gender": "Colt",
"hexColor": "9C2542",
"horseId": 10548,
"imgUrl": "https://img.zed.run/horses/9C2542.svg",
"name": "Sargent Pepper",
"ownerAddress": "0xB2580Eb6f0d504289E527d4Ac6eC04F134077431",
"stableName": "Rohan's Finest"
},
{
"bloodline": "Nakamoto",
"breedType": "exclusive",
"class": 5,
"coat": "Midnight Black",
"finalPosition": "10",
"finishTime": 147.0546,
"gate": "6",
"gen": "Z6",
"gender": "Colt",
"hexColor": "000000",
"horseId": 8644,
"imgUrl": "https://img.zed.run/horses/000000.svg",
"name": "Tenkamenin",
"ownerAddress": "0x66B2FBfc3c016aAF66AFb9B3fDAAbb299b2d6b93",
"stableName": "Dream Stable"
}
],
"length": 2400,
"name": "Grande Prêmio Olinda",
"prizePool": {
"first": "840000000000000",
"second": "350000000000000",
"third": "210000000000000"
},
"raceId": "8nAhB68",
"startTime": "2021-02-16T02:16:00",
"status": "finished",
"weather": "Sunny"
}
}
],
"pageInfo": {
"endCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "YXJyYXljb25uZWN0aW9uOjA="
}
}
}
}
Learn how to get your API key here: https://docs.zed.run/getting-started/api-keys
Available Filters (Query Variables)
Query variables used to filter results.
You must apply at least one filter to get results succesfully.
If you go to https://zed.run/racing/results you will see results filtered by distance. This is the default filter for race results.
{
"first": 2,
"input": {
"distance": {
"from": 1000,
"to": 2600
}
}
}
You can filter just by city or country name or both:
Filter by city:
{
"first": 2,
"input": {
"location": {
"city": "Katowice"
}
}
}
Filter by country:
{
"first": 2,
"input": {
"location": {
"country": "Poland"
}
}
}
Filter by both country and city name:
{
"first": 2,
"input": {
"location": {
"country": "Poland",
"city": "Katowice"
}
}
}
Dates have to passed in the following format: "YYYY-MM-DD HH:MM:SS"
{
"first": 2,
"input": {
"dates": {
"from": "2020-12-01 00:00:00",
"to": "2021-12-01 23:59:00"
}
}
}
Classes:
0 - Griffin
1 - Class I
2 - Class II
3 - Class III
4 - Class IV
{
"first": 2,
"input": {
"classes": [
1,
2,
3,
4
]
}
}
You can learn more about classes here: https://community.zed.run/2020/07/08/beta-racing-classes-version-1/
This filter requires authentication. The token can be copied from ws_token response (https://api.zed.run/api/v1/auth/ws_token)
{
"first": 10,
"input": {
"onlyMyRacehorses": true,
"distance": {
"from": 1000,
"to": 2400
}
}
}
You can freely combine multiple filters to narrow down your results:
{
"first": 2,
"input": {
"onlyMyRacehorses": false,
"location": {
"country": "Poland",
"city": "Katowice"
},
"dates": {
"from": "2020-12-01 00:00:00",
"to": "2021-12-01 23:59:00"
},
"distance": {
"from": 1000,
"to": 2400
},
"classes": [
1,
2,
3,
4
]
}
}
Request Body (GraphQL Query)
The second part of our GraphQL request requires the actual body that also can be used to display results that are only neccecary / interested for us.
query ($input: GetRaceResultsInput, $before: String, $after: String, $first: Int, $last: Int) {
getRaceResults(before: $before, after: $after, first: $first, last: $last, input: $input) {
edges {
cursor
node {
country
city
name
length
startTime
fee
raceId
weather
status
class
prizePool {
first
second
third
}
horses {
horseId
finishTime
finalPosition
name
gate
ownerAddress
bloodline
gender
breedType
gen
coat
hexColor
imgUrl
class
stableName
}
}
}
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
}
}
One of the benefits of GraphQL is the ability to select only specific fields we want to see in our results. Let's say we want to get only names of the horses, the first prize from the pool and country name:
query ($input: GetRaceResultsInput, $before: String, $after: String, $first: Int, $last: Int) {
getRaceResults(before: $before, after: $after, first: $first, last: $last, input: $input) {
edges {
cursor
node {
country
prizePool {
first
}
horses {
name
}
}
}
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
}
}
Go ahead and experiment with different variations of the results.
Pagination
You probably noticed that I used "first": 2 in the query variables:
{
"first": 2,
"input": {
"distance": {
"from": 1000,
"to": 2600
}
}
}
This controls the number of results per page and does not have to be "2", can be any other positive integer value but how can I get to the next result?
This part of the query returns all we need to know if we can traverse through the pages:
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
To ilustrate that better, let's narrow down results to a few fields:
query variables:
{
"first": 2,
"input": {
"onlyMyRacehorses": false,
"distance": {
"from": 1000,
"to": 2400
}
}
}
query:
query ($input: GetRaceResultsInput, $before: String, $after: String, $first: Int, $last: Int) {
getRaceResults(before: $before, after: $after, first: $first, last: $last, input: $input) {
edges {
cursor
node {
country
city
}
}
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
}
}
And here's a sample result:
{
"data": {
"getRaceResults": {
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjA=",
"node": {
"city": "Hamburg",
"country": "Germany"
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"city": "Prague",
"country": "Czech Republic"
}
}
],
"pageInfo": {
"endCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "YXJyYXljb25uZWN0aW9uOjA="
}
}
}
}
Notice that endCursor is the same as the cursor of the last edge (the one with Prague) and startCursor is the same as the first edge (Hamburg).
As you can see each edge has a cursor assigned:
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjA=",
and pageInfo tells us if we have the next page, the previous one (always false for the very first page) and provides cursors (think about them as bookmarks) for the next pages with the results.
"pageInfo": {
"endCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "YXJyYXljb25uZWN0aW9uOjA="
}
Having cursor assigned to a concrete edge, allows us to display results before or after the concrete edge. This is a way more flexible then traditional pagination method and much more mobile friendly.
And here's how we pass cursors to the query:
{
"first": 4,
"after": "YXJyYXljb25uZWN0aW9uOjE=",
"input": {
"onlyMyRacehorses": false,
"distance": {
"from": 1000,
"to": 2400
}
}
}
Adding after along with the cursor value:
"after": "YXJyYXljb25uZWN0aW9uOjE="
tells GraphQL to return the first (4 in our case) races of the next page.
{
"data": {
"getRaceResults": {
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjI=",
"node": {
"city": "Stockholm",
"country": "Sweden"
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjM=",
"node": {
"city": "Curepipe",
"country": "Mauritius"
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjQ=",
"node": {
"city": "Lahore",
"country": "Pakistan"
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjU=",
"node": {
"city": "Stockholm",
"country": "Sweden"
}
}
],
"pageInfo": {
"endCursor": "YXJyYXljb25uZWN0aW9uOjU=",
"hasNextPage": true,
"hasPreviousPage": true,
"startCursor": "YXJyYXljb25uZWN0aW9uOjI="
}
}
}
}
Now you see that both hasNextPage nad hasPreviousPage are true, it means we have some races on the prevoius page and we can go back, let's try.
Display 3 races before the race in Mauritius. Let's check the cursor of that race:
"cursor": "YXJyYXljb25uZWN0aW9uOjM=",
"node": {
"city": "Curepipe",
"country": "Mauritius"
}
To traverse back we use "before" along with "last" param in query variables:
{
"last": 4,
"before": "YXJyYXljb25uZWN0aW9uOjM=",
"input": {
"onlyMyRacehorses": false,
"distance": {
"from": 1000,
"to": 2400
}
}
}
Result:
{
"data": {
"getRaceResults": {
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjA=",
"node": {
"city": "Hamburg",
"country": "Germany"
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"city": "Prague",
"country": "Czech Republic"
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjI=",
"node": {
"city": "Stockholm",
"country": "Sweden"
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjM=",
"node": {
"city": "Curepipe",
"country": "Mauritius"
}
}
],
"pageInfo": {
"endCursor": "YXJyYXljb25uZWN0aW9uOjM=",
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "YXJyYXljb25uZWN0aW9uOjA="
}
}
}
}
More about GraphQL pagination can be found in the official documentation: https://graphql.org/learn/pagination/
We will update our GraphQL schema in the upcoming version, so each field will have its own description there.
Last updated
Was this helpful?