Incorrect result by trying to get Events

Hello,

Trying to get events from this call https://api.smarkets.com/v3/events/ with the help of Postman, i get only false bettable and no tree, json is like this :

{

“events”: [

{

“bettable”: false,

“created”: “2010-05-08T16:31:52.714438Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/cycling”,

“hidden”: false,

“id”: “102002”,

“inplay_enabled”: true,

“modified”: “2017-07-23T17:18:24.457318Z”,

“name”: “Cycling”,

“parent_id”: null,

“short_name”: null,

“slug”: “cycling”,

“special_rules”: null,

“start_date”: null,

“start_datetime”: null,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2010-05-17T17:45:37.845704Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/tennis”,

“hidden”: false,

“id”: “102016”,

“inplay_enabled”: true,

“modified”: “2012-12-05T06:39:23.711880Z”,

“name”: “Tennis”,

“parent_id”: null,

“short_name”: null,

“slug”: “tennis”,

“special_rules”: null,

“start_date”: “2018-02-02”,

“start_datetime”: “2018-02-02T00:00:00Z”,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2010-05-24T18:20:23.345963Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/boxing”,

“hidden”: false,

“id”: “102025”,

“inplay_enabled”: true,

“modified”: “2012-11-25T09:48:17.743804Z”,

“name”: “Boxing”,

“parent_id”: null,

“short_name”: null,

“slug”: “boxing”,

“special_rules”: null,

“start_date”: null,

“start_datetime”: null,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2010-07-15T12:45:15.785011Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/golf”,

“hidden”: false,

“id”: “117002”,

“inplay_enabled”: true,

“modified”: “2017-08-10T11:49:36.504629Z”,

“name”: “Golf”,

“parent_id”: null,

“short_name”: null,

“slug”: “golf”,

“special_rules”: null,

“start_date”: “2018-05-10”,

“start_datetime”: “2018-05-10T00:00:00Z”,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2010-07-19T16:48:54.746227Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/football”,

“hidden”: false,

“id”: “121005”,

“inplay_enabled”: true,

“modified”: “2011-07-26T17:32:24.949704Z”,

“name”: “Football”,

“parent_id”: null,

“short_name”: null,

“slug”: “football”,

“special_rules”: null,

“start_date”: null,

“start_datetime”: null,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2010-07-29T11:49:51.132304Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/politics/uk”,

“hidden”: false,

“id”: “121012”,

“inplay_enabled”: true,

“modified”: “2012-04-05T14:29:44.443615Z”,

“name”: “UK Politics”,

“parent_id”: “742967”,

“short_name”: null,

“slug”: “uk”,

“special_rules”: null,

“start_date”: “2008-01-01”,

“start_datetime”: “2008-01-01T00:00:00Z”,

“state”: “upcoming”,

“type”: “generic”

},

{

“bettable”: false,

“created”: “2010-08-02T11:13:01.585679Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/politics/world”,

“hidden”: false,

“id”: “122048”,

“inplay_enabled”: true,

“modified”: “2012-04-05T14:30:00.240711Z”,

“name”: “World Politics”,

“parent_id”: “742967”,

“short_name”: null,

“slug”: “world”,

“special_rules”: null,

“start_date”: “2022-01-01”,

“start_datetime”: “2022-01-01T00:00:00Z”,

“state”: “upcoming”,

“type”: “generic”

},

{

“bettable”: false,

“created”: “2010-08-10T08:27:37.746416Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/tv-and-entertainment/bbc-sports-personality2”,

“hidden”: false,

“id”: “123041”,

“inplay_enabled”: true,

“modified”: “2012-12-16T22:30:00.098379Z”,

“name”: “BBC Sports Personality”,

“parent_id”: “742968”,

“short_name”: null,

“slug”: “bbc-sports-personality-2010”,

“special_rules”: null,

“start_date”: “2018-12-16”,

“start_datetime”: “2018-12-16T20:00:00Z”,

“state”: “upcoming”,

“type”: “generic”

},

{

“bettable”: false,

“created”: “2010-09-23T15:53:42.636525Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/snooker”,

“hidden”: false,

“id”: “134039”,

“inplay_enabled”: true,

“modified”: “2012-12-12T06:16:32.264643Z”,

“name”: “Snooker”,

“parent_id”: null,

“short_name”: null,

“slug”: “snooker”,

“special_rules”: null,

“start_date”: “2016-01-10”,

“start_datetime”: “2016-01-10T13:00:00Z”,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2010-10-06T10:32:07.998297Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/politics/uk/by-elections”,

“hidden”: false,

“id”: “136076”,

“inplay_enabled”: true,

“modified”: “2012-05-26T00:27:27.416569Z”,

“name”: “By-elections”,

“parent_id”: “121012”,

“short_name”: null,

“slug”: “by-elections”,

“special_rules”: null,

“start_date”: “2019-07-25”,

“start_datetime”: “2019-07-25T00:00:00Z”,

“state”: “upcoming”,

“type”: “generic”

},

{

“bettable”: false,

“created”: “2010-10-26T10:28:29.356946Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/baseball”,

“hidden”: false,

“id”: “138001”,

“inplay_enabled”: true,

“modified”: “2017-07-14T00:55:08.843632Z”,

“name”: “Baseball”,

“parent_id”: null,

“short_name”: null,

“slug”: “baseball”,

“special_rules”: null,

“start_date”: null,

“start_datetime”: null,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2010-10-28T14:35:30.231445Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/american-football”,

“hidden”: false,

“id”: “138004”,

“inplay_enabled”: true,

“modified”: “2017-08-03T00:51:32.863249Z”,

“name”: “American Football”,

“parent_id”: null,

“short_name”: null,

“slug”: “american-football”,

“special_rules”: null,

“start_date”: “2018-11-04”,

“start_datetime”: “2018-11-04T00:00:00Z”,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2010-11-16T13:32:24.831249Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/cricket”,

“hidden”: false,

“id”: “139092”,

“inplay_enabled”: true,

“modified”: “2012-03-05T13:20:07.888692Z”,

“name”: “Cricket”,

“parent_id”: null,

“short_name”: null,

“slug”: “cricket”,

“special_rules”: null,

“start_date”: null,

“start_datetime”: null,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2011-01-07T12:22:52.026356Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/darts”,

“hidden”: false,

“id”: “146089”,

“inplay_enabled”: true,

“modified”: “2017-07-31T01:28:24.232829Z”,

“name”: “Darts”,

“parent_id”: null,

“short_name”: null,

“slug”: “darts”,

“special_rules”: null,

“start_date”: null,

“start_datetime”: null,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2011-01-07T13:43:56.250354Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/basketball”,

“hidden”: false,

“id”: “146090”,

“inplay_enabled”: true,

“modified”: “2017-07-14T01:02:31.518811Z”,

“name”: “Basketball”,

“parent_id”: null,

“short_name”: null,

“slug”: “basketball”,

“special_rules”: null,

“start_date”: “2018-01-27”,

“start_datetime”: “2018-01-27T00:00:00Z”,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2011-01-17T15:59:02.538354Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/politics/world/ireland”,

“hidden”: false,

“id”: “148128”,

“inplay_enabled”: true,

“modified”: “2011-10-29T09:13:03.011439Z”,

“name”: “Ireland”,

“parent_id”: “924651”,

“short_name”: null,

“slug”: “ireland”,

“special_rules”: null,

“start_date”: “2018-10-26”,

“start_datetime”: “2018-10-26T00:00:00Z”,

“state”: “upcoming”,

“type”: “generic”

},

{

“bettable”: false,

“created”: “2011-01-24T15:23:37.686355Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/horse-racing”,

“hidden”: false,

“id”: “153010”,

“inplay_enabled”: true,

“modified”: “2011-02-06T22:53:49.598354Z”,

“name”: “Horse Racing”,

“parent_id”: null,

“short_name”: null,

“slug”: “horse-racing”,

“special_rules”: null,

“start_date”: “2018-02-27”,

“start_datetime”: “2018-02-27T00:00:00Z”,

“state”: “upcoming”,

“type”: “top_level_event”

},

{

“bettable”: false,

“created”: “2011-01-24T15:30:33.866354Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/horse-racing/kempton”,

“hidden”: false,

“id”: “153011”,

“inplay_enabled”: true,

“modified”: “2017-08-10T05:53:49.038382Z”,

“name”: “Kempton”,

“parent_id”: “153010”,

“short_name”: null,

“slug”: “kempton”,

“special_rules”: null,

“start_date”: “2018-03-31”,

“start_datetime”: “2018-03-31T00:00:00Z”,

“state”: “upcoming”,

“type”: “generic”

},

{

“bettable”: false,

“created”: “2011-01-25T10:50:48.662354Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/horse-racing/musselburgh”,

“hidden”: false,

“id”: “153100”,

“inplay_enabled”: true,

“modified”: “2017-08-12T05:53:27.902044Z”,

“name”: “Musselburgh”,

“parent_id”: “153010”,

“short_name”: null,

“slug”: “musselburgh”,

“special_rules”: null,

“start_date”: “2018-03-31”,

“start_datetime”: “2018-03-31T00:00:00Z”,

“state”: “upcoming”,

“type”: “generic”

},

{

“bettable”: false,

“created”: “2011-01-27T12:05:22.674354Z”,

“description”: null,

“display_order”: 0,

“end_date”: null,

“full_slug”: “/sport/rugby-league”,

“hidden”: false,

“id”: “153235”,

“inplay_enabled”: true,

“modified”: “2017-08-09T06:28:54.665083Z”,

“name”: “Rugby League”,

“parent_id”: null,

“short_name”: null,

“slug”: “rugby-league”,

“special_rules”: null,

“start_date”: null,

“start_datetime”: null,

“state”: “upcoming”,

“type”: “top_level_event”

}

],

“pagination”: {

“next_page”: “?state=new&state=upcoming&state=live&with_new_type=False&sort=id&limit=20&include_hidden=False&pagination_last_id=153235”

}

}

Do you have an idea how i’m doing things wrong ?

Hi Alexandre,

To get all events, you can simply keep following the pagination links until “next_page” is null.

In your example, the 2nd call would be: api.smarkets.com/v3/events/?state=new&state=upcoming&state=live&with_new_type=False&sort=id&limit=20&include_hidden=False&pagination_last_id=153235

Pagination is a way to split one big request into multiple smaller ones, so that our servers aren’t overloaded.

João

Hi Joao,

I wonder why we get events on which we can’t bet.
In this example, i got only non bettable events, how can that be possible?

Our events follow a tree structure, where you can have leagues as events, described here:

So, as those leagues are not real betting events, that flag will be False

Except the “include_hidden” parameter, i don’t see other that would allow to avoid non bettable events in the result. Is there any or we do it ourself by deleting them from the results?

I will have to learn the league terminology and what it implies but i was surprised to not see a parameter avoiding non bettable events because in the result as it represents a potential heavy load on your servers.

You can use type_scope=single_event and the result will only contain bettable events.