#10 PHP JSON API EXAMPLE
JSON: JavaScript Object Notation
MySQL:My Structured Query Language
A simple basic JSON API built with PHP and MySQL. Inside the api folder there are 4 PHP scripts. These scripts can be called using two parameters:
The API Key: e.g = API_KEY=926bc852-1d16-414e-8112-5595bc16ffeb
The Username: e.g = USERNAME=admin@gmail.com
Once the API key is verified the query will return a JSON string with the specified data returned. For example calling checkApiKey.php will return the JSON {"result": 0,"id": "16"} where result = 0 means success and any other result will be a failure code.

A full example calling checkApiKey.php bellow:
Be sure to import test.sql into your MySQL database. test.sql contains two basic tables namely api_keys and users containing the data we want to query with this API.
Please note this is for demonstration purposes. Quite a few security checks have been left out for simplicity’s sake. I’ll make a sophisticated PHP API at a later stage.

