Php, restfull json(p) service via Slim framework
You can manually call api from console via curl like this:
curl -i -X GET http://localhost/slim/api/users
curl -i -X GET http://localhost/slim/api/users/1
curl -i -X POST -H "Content-Type: application/json" -d "{\"name\": \"test\", \"email\": \"[email protected]\", \"age\": 25}" http://localhost/slim/api/users
curl -i -X PUT -H "Content-Type: application/json" -d "{\"id\": 3, \"name\": \"test\", \"email\": \"[email protected]\", \"age\": 23}" http://localhost/slim/api/users/3
curl -i -X DELETE http://localhost/slim/api/users/3
Also you can call api from browser console like this:
var users = $.restInterfaceTo('/slim/api/users');
users.all(console.log);
users.one(1, console.log);
users.add({name: 'Alex', mail: '[email protected]', age: 27}, console.log);
users.put(3, {name: 'alex', mail: '[email protected]', age: 23}, console.log);
users.del(3, console.log);
Just add &callback=cb
to any resuest and you will see what happens
mysql -u root --password=[PASSWORD] < db.sql
For simplification DBUSER
and DBPASS
and Slims encrypted cookies used for auth