Series and the REST API
WP REST API
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.
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:
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!