Book Image

Alfresco Developer Guide

Book Image

Alfresco Developer Guide

Overview of this book

Table of Contents (17 chapters)
Alfresco Developer Guide
Credits
About the Author
About the Reviewers
Preface
Index

Planning the SomeCo Whitepapers and Ratings API


Before diving into the examples, let's plan the new API at high level. The following table outlines the URLs, the HTTP methods, and the response formats for each:

URL

Method

Description

Response formats

/someco/whitepapersGETReturns a list of Whitepapers.HTML, JSON
/someco/rating?id={id}GETGets the average rating for a given Whitepaper by passing in the Whitepaper's noderef.HTML, JSON
/someco/rating?id={id}&rating={rating}&user={user}POSTCreates a new rating for the specified Whitepaper by passing in a rating value and the user who posted the rating.HTML, JSON
/someco/rating?id={id}DELETEDeletes all ratings for a specified Whitepaper.HTML

When this API is in place, frontend developers can incorporate Whitepapers and user-contributed ratings into the SomeCo web site. The following screenshots show pages that use the API you're going to build to query for Whitepaper and ratings data. It looks like the folks at SomeCo have shamelessly ripped...