Skip to content
mattiaslevin edited this page Nov 2, 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 RESTful API. It tries to adhere REST guidelines as is practically possible.

Formats

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

json    someserver.com/api/movie/like/1209         
kml     someserver.com/api/movie/product/nearby.kml    

JSONP

The backend support JSONP out the box. All you have to is provide an extra request parameter callback= in your request and the response will wrapped in the method name you specify.

 jsonp   someserver.com/api/movie/like/1209?callback=likeCBMethod

Please note that the parameter will be stripped by the server during a direct and the client needs to apply it again.

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/like/1209    
v2   someserver.com/api/v2/movie/like/1209        
v3   someserver.com/api/v3/movie/like/1209    

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.

POST     Allows you to create or update a new object
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 appUser and appPassword in return. The appUser and appPassword 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 requestS and returned json please check the detailed REST documentation TBD

Ratings and reviews

Set a rating and optional review comment for a product.

api/{version}/{domain}/rating               POST       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
api/{version}/{domain}/rating/histogram?productId=    GET        Get a histogram of all ratings 

Likes

Add a like to a product.

api/{version}/{domain}/like                 POST       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 

Thumbs up/down

Add a thumbs up or down to a product.

api/{version}/{domain}/thumbs/up            POST       Thumbs up for a product
api/{version}/{domain}/thumbs/down          POST       Thumbs down for a product            
api/{version}/{domain}/thumbs/{id}          DELETE     Delete a like   
api/{version}/{domain}/thumbs/{id}          GET        Get like details   
api/{version}/{domain}/thumbs?username=     GET        Get my likes                                
api/{version}/{domain}/thumbs?productId=    GET        Get all likes for product 

Comments

Comment a product.

api/{version}/{domain}/comment              POST       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}              POST     Add as 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/rated/most       GET       Get most rated products   
api/{version}/{domain}/product/rated/top        GET       Get top rated products
api/{version}/{domain}/product/rated?username=  GET       Get all products I have rated   
api/{version}/{domain}/product/liked/most       GET       Get most liked products     
api/{version}/{domain}/product/liked?username=  GET       Get all products I have liked 
api/{version}/{domain}/product/thumbs/up/most   GET       Get most thumbs up products    
api/{version}/{domain}/product/thumbs/down/most GET       Get most thumbs up products      
api/{version}/{domain}/product/thumbs?username= GET       Get all products I have thumbed up or down 
api/{version}/{domain}/product/commented/most   GET       Get most commented products      
api/{version}/{domain}/product/commented?username= GET   Get all products I have commented 
api/{version}/{domain}/product/favorites?username= 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 Google accounts.

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

User management:
api/{version}/backoffice/admin                      POST      Create a new app admin
api/{version}/backoffice/admin                      GET       Get current app admin details
api/{version}/backoffice/admin/{email}              DELETE    Delete an app admin   
api/{version}/backoffice/admin/{email}              GET       Get a specific app admin details   
api/{version}/backoffice/admin/all                  GET       Get all app admins
api/{version}/backoffice/admin/{email}/status/{status} POST   Update the app admin status 

App management:	
api/{version}/backoffice/app/{domain}               POST      Create a new app
api/{version}/backoffice/app/{domain}?emails=       POST      Update admins for the app
api/{version}/backoffice/app/{domain}               GET       Get app details
api/{version}/backoffice/app/{domain}               DELETE    Delete an app
api/{version}/backoffice/app/{domain}/password      POST      Generate a new app password
api/{version}/backoffice/app/my                     GET       Get all apps owned by the current user
api/{version}/backoffice/app/all                    GET       Get all apps in the system

Clone this wiki locally