Posted on 10-21-2013
I'm working on a series of simple scripts that help people deploy APIs from some of the most common data sources. I'm starting with a series of PHP scripts, and first up is MySQL to API.
For this PHP implementation, I'm using the SLIM framework, which provides a dead simple REST framework you can use to deploy an API from a variety of data sources. To begin deploying an API from your MySQL database, download the REST library and upload to your server that runs PHP.
Slim is pretty straightforward to work with, to add each API endpoint you just add a single PHP file under methods. For this how-to guide we are going to add a simple endpoint from our products database.
Next you just add an include reference in the index page for your slim implementation:
This API just uses ID, Name, Price and Description of the product, and queries by a simple query parameter. You can use this as a template for your own product database, adding and removing fields as you need, or completely retrofitting for any database table. That is it, now you have a simple product API that pulls a list of products from a MySQL database.
comments powered by Disqus
Winning in the API Economy
|Download as PDF|
Latest Blog Posts
- What Version Of The API Economy Are You Investing In?
- I Am Up To 34 APIs Out Of The Netherlands
- Hello World Product API With Blueprint, RAML And Swagger
- The New Github Developer Program and Integrations Page
- I Have A Valuable API Resource, What Now?
- A Better Understanding Of Government APIs And Their Consumers Before Considering Charging For Use
- So You Wanna Do a Spreadsheet or Database To API Startup
- Jumpstarting the Automobile API Conversation With Carvoyant
- Some Of The Common Building Blocks of Payment APIs
- API Badging and Credentialing To Demonstrate Skills