Deploy and Manage a RESTful API with CodeIngiter and 3Scale05 Sep 2011
At Mimeo, my API developers were running into problems integrating with our cloud print API, I needed a fast way to virtualize and deploy an API built on top of my existing REST API. A quick and dirty way I could research and develop new APIs, launch, measure and manage without getting IT involved.
So I virtualized four document APIs using the CodeIgniter open-source PHP web framework, Amazon EC2, 3Scale self-service API management service and Mimeo Connect Cloud Print API.
First I launched a copy of the CodeIgniter framework on my existing Amazon EC2 instance, configured mod_rewrite to handle my URLs, and wrote seven API methods dedicated to printing just one type of document, like a poster. I now had a simple RESTful API that handled requests, and returned XML and JSON responses.
I need a quick way to manage access to my API and measure its usage. So I would know who was using it, how they were using it, and if it was worth while to keep the API and put more resources into it. I selected 3Scale API management, one of two free, self-service API mangement platforms out there. The other is Mashape, but they are still in BETA, so 3Scale was the only other solution I could deploy for free, and scale as I needed when things were successful.
I deployed the 3Scale PHP connector on my Amazon EC2 instance as part of the CodeIgniter REST framework. I then launched my 3Scale self-service API area, which provides me with:
- Self-Service Developer Registration / Login / Key Management
- Forum & Support
- API Metering / Billing
- Analytics and API Usage Reporting
I now had a simple RESTful API, that had self-service documentation, app key registration, forum, and support. I received emails when new developers registered, could track how much they used, and turn off access when needed.
I was open for business, using the CodeIgniter tools as a RESTful framework and 3Scale as API management solution I was able to deploy and manage my APIs on an existing Amazon EC2 instance for free, with minimal work, and the platform will scale as my APIs get more usage.