MLB Pick'em on Ignition via Free MLB API

Please let there be no misunderstanding that Bill is the mad scientist that figured out how to use an under-documented API and pull it into a brand new Ignition 8.0 Vision client. He deserves all the credit for this one!

The only thing Corso Systems may love more than Ignition is creating crazy applications in it. So, I was only half joking when I proposed we do a pick-em league for MLB like we have with the NFL and NCAA. It’s only 2,430 regular season games, after all!

We quickly settled on a saner way to play. Everybody picks one team from each division and earns points for that team winning throughout the season. Easy!

Since it was only a couple of days before opening day when we decided to make this game a reality, I turned to my tried-and-true development environment to make it happen.

Vision in Ignition 8.0

Central league teams showing in a template repeater in Ignition

At its core, not much has changed with Vision in Ignition 8.0. It’s the same drag and drop WYSIWYG editor we know and love. However, the individual components got a major facelift. I didn’t have to change a single foreground or background color, font or border to arrive at great looking screens with a flat look and high-performance feel.

The Designer also benefited from the same overhaul. The neutral backgrounds and sparse use of color work together to highlight the important areas of the Vision workspace, which has been given its own entry in the project browser with the addition of the Perspective module.

Project Development and Visualization

MLB Team Template in Ignition showing the Chicago Cubs logo

The bulk of the work was creating and populating the database tables. We’re keeping a record of each team with a reference to their league, division, the team’s unique identifier in the MLB API and the image path for the team logo. With just a quick template and a simple query to populate a template repeater from the database, we have everything we need for visualization.

The MLB Stats API

MLB exposes a ton of live and historical data in its stats API. Although the API is free and open to the public, there seems to be no official documentation at this time. What I’ve gathered is that MLB transitioned from an XML style repository to a new JSON based implementation. Luckily, dedicated users of the old API have figured out how to use the new implementation and have shared their findings online.

Knowing the base URL, you can pass in a date or date range to get a list of scheduled games and the results. I implemented a Python script to do this every morning to check the previous days games and update each user’s score in the database.

Want to know more about Corso System's games in Ignition? Reach out and let us know!

Updated - 6/17/2022

Previous
Previous

Digital Transformation: Data Migration Process and Tools

Next
Next

Canary Historian and Axiom Overview