Skip to content
mattiaslevin edited this page Aug 18, 2012 · 33 revisions

This section contains an overview of the the available REST end-points.

If you platform already have a SDK we recommend you use that instead of integrating directly towards the rest interface.

Introduction

The Pocket-Reivews API is a fully RESTful API. This means it adheres as closely to REST guidelines as possible.

Formats

The API returns data as json by default, but you can also choose to return data in pson and for some methods klm format. Simply specify the format as the file extension in the url.

json    someserver.com/api/movie/1209/like         
jsonp   someserver.com/api/movie/1209/like.jsonp         
klm     someserver.com/api/movie/nearby.klm    

Versions

The API has multiple versions that are used to prevent changes to the API from breaking your apps. Development of new features will always be on the most current version of the API, while development on previous versions of the API will be limited to severe bug fixes only.

To specify which version of the API you wish to access, you must indicate that version after the /api and before the domain.

v1   someserver.com/api/movie/1209/like    
v2   someserver.com/api/v2/movie/1209/like        
v3   someserver.com/api/v3/movie/1209/like    

Methods

Methods are used to tell Pocket-Reviews what you want to do with a specific object. You can create, delete and update most objects via the REST API.

PUT      Allows you to create a new object, such as a Like, Comment or Rating
POST     Update an existing object
DELETE   Delete an existing object
GET      Get an existing object

Authentication

In order to use the API, your application needs to use Basic Authentication.

When you register you app through the backend you need to select an unique domain and the backend generates an appId and appKey in return. The appId and appKey form the user and password respectively in the Basic Authentication. More information about Basic Authentication can be found here Wikipedia.

End-points

The following end-points are available.

For a detailed description of the request and returned json please check the details REST documentation TBD

Ratings and reviews

Set a rating an optional review comment for a product.

api/{version}/{domain}/rating               PUT        Rate a product                            
api/{version}/{domain}/rating/{id}          DELETE     Delete a rating  
api/{version}/{domain}/rating/{id}          GET        Get rating details  
api/{version}/{domain}/rating?username=     GET        Get ratings for a user
api/{version}/{domain}/rating?productId=    GET        Get all ratings for product  

Likes

Add a link (+1 or thumbs up) for a product.

api/{version}/{domain}/like                 PUT        Like a product      
api/{version}/{domain}/like/{id}            DELETE     Delete a like   
api/{version}/{domain}/like/{id}            GET        Get like details   
api/{version}/{domain}/like?username=       GET        Get my likes                                
api/{version}/{domain}/like?productId=      GET        Get all likes for product 

Comments

Comment a product.

api/{version}/{domain}/comment              PUT        Comment a product                       
api/{version}/{domain}/comment/{id}         GET        Get comment details  
api/{version}/{domain}/comment/{id}         DELETE     Delete a comment     
api/{version}/{domain}/comment?username=    GET        Get my Comments  
api/{version}/{domain}/comment?productId=   GET        Get all comments for product

Favorites

Add a products to my favorites.

api/{version}/{domain}/favorites/{username}              PUT      Make a product a favorite               
api/{version}/{domain}/favorites/{username}              GET      Get all favorites                     
api/{version}/{domain}/favorites/{username}?productId=   DELETE   Delete a product from favorites

Product

Get products with related information, e.g. average rating, number of likes, comments etc.

api/{version}/{domain}/product                 GET       Get all products                           
api/{version}/{domain}/product/{product}       GET       Get one product     
api/{version}/{domain}/product?ids=            GET       Get several products                        
api/{version}/{domain}/product/nearby          GET       Get products nearby
api/{version}/{domain}/product/mostliked       GET       Get most liked products   
api/{version}/{domain}/product/mostcommented   GET       Get most commented     
api/{version}/{domain}/product/mostrated       GET       Get most rated    
api/{version}/{domain}/product/toprated        GET       Get top rated products   
api/{version}/{domain}/product/my/liked        GET       Get all products I have liked 
api/{version}/{domain}/product/my/rated        GET       Get all products I have rated     
api/{version}/{domain}/product/my/commented    GET       Get all products I have commented 
api/{version}/{domain}/product/my/favorites    GET       Get all favorites products     

Backoffice

There should never be any need to integrated towards these end-points.

Security for these end-points are implemented using GAE Users service.

Autentication:
api/{version}/backoffice/user/login            GET       Login a backoffice user with Google
api/{version}/backoffice/user/logout           GET       Logout a backoffice user from Google

User management:
api/{version}/backoffice/user                  PUT       Create a new user 
api/{version}/backoffice/user                  GET       Get current user details
api/{version}/backoffice/user/{userId}         DELETE    Delete a user   
api/{version}/backoffice/user/{userId}         GET       Get a specific users details   
api/{version}/backoffice/user/all              GET       Get all backoffice users
api/{version}/backoffice/user/{userId}/status/{status) POST   Update the user status 

App management:	
api/{version}/backoffice/app/{domain}          PUT       Create a new app
api/{version}/backoffice/app/{domain}          GET       Get app details
api/{version}/backoffice/app/{domain}          DELETE    Delete app
api/{version}/backoffice/app/{domain}/appKey   POST      Generate a new appKey
api/{version}/backoffice/app/my                GET       Get all apps owned for the current user
api/{version}/backoffice/app/all               GET       Get all apps in the system

Clone this wiki locally