In this quick post to his site Freek Van der Herten looks at the "unofficial Forge API" you can use to do some (limited) things with your Forge account and servers. Forge is a service in the Laravel ecosystem for managing and deploying servers with a simple and clean frontend interface.
You might not know this but Forge already has an API, it’s just not a documented and feature complete one. Open up your dev tools and inspect the web requests being sent while you do various stuff on Forge.
Marcel Pociot published a new package called Blacksmith (great name Marcel) that can make calls to that API.
The package submits a login form behind the scenes to authenticate but other than that it's normal API calls. The package includes methods allowing you to:
- get a list of all active servers
- return server by ID
- get the listing of sites
- update metadata
- get environment information
...among other things. You can find out more about the package in its GitHub repository.