So far I’ve gone through how to get teams, players and playoff brackets through the WP REST API. Today, I’m going to do the same for playoff series.
Getting series
The teams endpoint is /sportsbench/series. And in order to tell you how to get series, I first need to tell you the available fields that will appear when you make a GET request. They are:
- series_id
- bracket_id
- series_format
- playoff_round
- team_one_id
- team_one_seed
- team_two_id
- team_two_seed
- game_ids
From here, you can search for series using any of these fields.
Adding, updating and deleting series
In terms of adding, updating and deleting series, it’s also pretty simple once you know what you’re doing.
When you’re adding a series, you don’t need to specify a series id. That will get assigned automatically. Also, you don’t need to specify every field for a series, similar to the normal add playoff series page in the WordPress backend.
Obviously, you will need the series id for updating and deleting series.
Other than that, there’s not too much more to this.
What can you do with this?
Realistically, you can do just about anything you want with this and the REST API. You can create separate web applications or create a mobile application for your league and call in data from the website.
The possibilities are endless, and that’s the best part of the REST API. You can do really cool things and not have to write thousands of lines of code. So have fun with it!
Leave a Reply