As our mobile devices become increasingly connected, client-server communications are also becoming increasingly necessary. Thankfully, a new guide has emerged that helps users setup a RESTful web API.

The new guide comes from XDA Forum Member Alkonic, and covers topics including setting up a database and PHP scrip, testing your new database server, and finally how to access this from Android. The guide is aimed towards relatively seasoned developers who have a working dev environment and have already written apps, but lack experience with MySQL or PHP.

What do budding cloud-enabled developers need to get started? Not much: an Android device to test with and a computer running on the same network, an Apache/MySQL/PHP server such as WAMP for Windows, and Postman Rest Client for Chrome. Thankfully the Alkonic also breaks summarizes the steps for those new to client-server communication:

  1. The client makes a request using a HTTP POST to a server
  2. The PHP script queries the MYSQL server
  3. The PHP script gets the SQL data
  4. The PHP script puts the data into an array and assigns keys for the values. The script then outputs the data as a JSON array. JSON (JavaScript Object Notation) is a standard for data exchange, and formats the data in a way both humans and computers can easily read.
  5. The app parses the JSON and displays the data.

To learn more, head over to the guide thread.