Skip to content

Latest commit

 

History

History
87 lines (78 loc) · 2.21 KB

README.md

File metadata and controls

87 lines (78 loc) · 2.21 KB

REST-in-SlimFramework

This a very api to understand REST operations as well as how to implement a multiplatform application via api. A simple android applicatoin is used to demonstate the simplicity of REST.

App Screenshot

ScreenShot

Installing API

Just upload the api folder on any web server or localhost. If you want to configure API with app then you must place the api on web server. You must have MongoDB installed on your server or pc.

Compiling app

The app need to be compiled on Android Studio. Before compiling please change the RootUrl from ApiConnection.java

##API USAGE Here is list of Resouces and action used at the api.

Resource HTTP Method Operation
/api/v1/contacts GET Returns an array of contacts
/api/v1/contacts POST Adds a new contact
/api/v1/contacts?type=star GET Returns an array of favourite contacts
/api/v1/contacts/:id GET Returns the contact with id of :id
/api/v1/contacts/:id PUT Update the contact with id of :id
/api/v1/contacts/:id DELETE Deletes the contact with id of :id
/api/v1/contacts/:id/star PUT Adds to favourites the contact with id of :id
/api/v1/contacts/:id/star DELETE Removes from favourites the contact with id of :id

API Usage

you can also check the operation from Terminal or using POSTMAN

Request

GET /api/v1/contacts
curl -i -H 'Accept: application/json' http://localhost/api/v1/contacts

Response

HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 99
{"status":200,"contacts":[{"contact_id":10,"name":"myname","number":"012345","is_favourite":true}]}