Last week, I went through the players endpoint in the WP REST API and how you can get, add, update and delete teams. Today, I’m going to do the same for brackets.
The teams endpoint is /sportsbench/brackets. And in order to tell you how to get teams, 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 teams using any of these fields.
Adding, updating and deleting brackets
In terms of adding, updating and deleting brackets, it’s also pretty simple once you know what you’re doing.
When you’re adding a bracket, you don’t need to specify a bracket id. That will get assigned automatically. Also, you don’t need to specify every field for a bracket, similar to the normal add playoff bracket page in the WordPress backend.
Obviously, you will need the bracket id for updating and deleting teams.
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!