Errata

RESTful Web Services Cookbook

Errata for RESTful Web Services Cookbook

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Section 7.3.3
7.3.3 second example response

Response shows HTTP response header "Vary: en"
should be "Vary: Accept-Language" (same as the other example)

Note from the Author or Editor:
The second example response in 7.3.3 should have the vary header as

Vary: Accept-Language

in place of

Vary: en

Anonymous  Jan 08, 2013 
Other Digital Version
8
HTML Response

The closing of the response should be </quote> not </html>

Christian Richards  Apr 29, 2011 
Printed
Page 10
GET request messages

The two GET requests on this page must include a "Host: www.example.org" header.

Subbu Allamaraju
Subbu Allamaraju
 
Mar 11, 2010 
Printed
Page 11
PUT request messages

The two PUT requests on this page must include a "Host: www.example.org" header.

Subbu Allamaraju
Subbu Allamaraju
 
Mar 11, 2010 
Printed, PDF,
Page 13
first paragraph --- it is actually a pseudo code

In Recipe 1.5, page 13 reads,

if(response.code == 200) {
//Success
...
}
else if (response.code >= 400) {
// Failure due to client error
...
}
else if (response.code > = 500) {
// Failure due to server error
...
}

It should be

if(response.code == 200) {
//Success
...
}
else if (response.code >= 500) {
// Failure due to client error
...
}
else if (response.code > = 400) {
// Failure due to server error
...
}

Prabhakhar Kaliyamurthy  May 13, 2011 
Printed
Page 17
The example below Discussion

There is a duplicate "Slug: Home Address" in this example.

Subbu Allamaraju
Subbu Allamaraju
 
Mar 11, 2010 
Printed
Page 17
Discussion

The number 1 used to refer the user resource should be on the
POST /user/smith HTTP/1.1
line and not on the duplicate Slug header

Note from the Author or Editor:
The number 1 used to refer the user resource should be on the

POST /user/smith HTTP/1.1

line and not on the duplicate Slug header

ugodp  May 06, 2010 
Printed
Page 26
fourth paragraph under Dicsussion

X-Forwarded-By should be X-Forwarded-For

Note from the Author or Editor:
The header

X-Powered-By: PHP/5.2.6-2ubuntu4.2

should be

X-Powered-For: PHP/5.2.6-2ubuntu4.2

DavidBiesack  Jan 04, 2013 
ePub
Page 54%
Response Examples

Several responses state the HTTP Header 'ETag' as 'E-Tag'

Nate Klaiber  Mar 25, 2014 
Printed
Page 60
Response in the example. The prev and next links' URI

The href for both next and prev should be

href="http://www.example.org/articles

instead of

href="http://www.example.org/books

Note from the Author or Editor:
The three atom:link elements in the response should appear as

<atom: link rel="self"
href="http: //www.example.org/articles?contains=cycling&start=10"/>
<atom: link rel="prev"
href="http: //www.example.org/articles?contains=cycling"/>
<atom: link rel="next"
href="http: //www.example.org/articles?contains=cycling&start=20"/>

ugodp  Jul 05, 2010 
PDF
Page 61
3rd line of Discussion

should say, include just the *non*-product-specific details

Note from the Author or Editor:
The second sentence under Discussion section should be as follows:

"For instance, if your collection of products can contain cars, boats, and motorcycles, include just the common aspects of those resources in the product collection."

lafros  Jul 10, 2010 
Printed
Page 84
Response in the example

Change

HTTP/1.1 301 Found

to

HTTP/1.1 301 Moved Permanently

Note from the Author or Editor:
The request-response flow on this page should read as

# Request
GET /users/1 HTTP/1.1
Host: www. example.org
Accept: application/json

# Response
HTTP/1. 1 301 Moved Permanently
Location: http: //www.example2.org/users/1

ugodp  May 07, 2010 
Printed
Page 89
code example under Discussion header

The atom link in the example reads like this:

<atom:link link href="https://east-nj1.photos.example.org..."

but should read like this:

<atom:link href="https://east-nj1.photos.example.org..."

John Ryder  May 29, 2012 
Printed
Page 101
1st paragraph

Paragraph refers to URI which is not present in the response listed on the previous page. I suspect the sentence should read:
"In this case, the server needs to document that the URI with link relation type http://www.example.org/purchase-req/auth is valid only for two minutes."

Note from the Author or Editor:
The first sentence on page 101 should read as

"In this case, the server needs to document that the URI with link relation type http://www.example.org/purchase-req/auth is valid only for two minutes."

Chris Hafey  Mar 20, 2010 
Printed
Page 101
The HTTP Request/Response

The POST URI does not match the href returned by the previous HTTP response, it should be:

POST /auth/ASBV_04_10_2009_1/09_31?_k=a1191fd35d23

Chris Hafey  Mar 20, 2010 
Printed
Page 141
Response in both examples in the page

The href attributes of "self" and "next" links in both the response examples look wrong.

First example (top of page):
the relative URI (/book/reviews) in does not match the relative URI in the GET request (/book/978-0374292881/reviews).

Second example (bottom of page):
the relative URI (/book/reviews) in does not match the relative URI in the GET request (/book/978-0374292881/reviews).
also, apart from after, the query parameters do not match those in the GET request.

Note from the Author or Editor:
The sample message at the top of the page should be as follows:

# Request
GET /book/978-0374292881/reviews?after=2009-08-15&sortbyDesc=created&limit=5 HTTP/1.1
Host: www.example.org

# Response
HTTP/1. 1 200 OK
Content-Type: application/xml;charset=UTF-8
Cache-Control: max-age=86400
Content-Language: en

<reviews total="23" xmlns: atom="http: //www. w3. org/2005/Atom"
xml: base="http://www.example.org/book/978-0374292881">
<atom: link rel="self"
href="/reviews?after=2009-08-15&sortbyDesc=created&limit=5"/>
<atom: link rel="next"
href="/reviews?after=2009-08-15&sortbyDesc=created&limit=5&start=5"/>
<review>
<atom: link rel="self" href="/book/review/03213"/>
<created>2007-08-02</created>
<title>Oversimplified?</title>
<body>. . . </body>
</review>
<! -- four more -->
. . .
</reviews>

The second message on this page should be as follows.

# Request
GET /book/978-0374292881/reviews?after=2009-08-15&sortbyDesc=created&limit=5&fields=link HTTP/1.1
Host: www.example.org

# Response
HTTP/1. 1 200 OK
Content-Type: application/xml;charset=UTF-8
Content-Language: en
<reviews total="23" xmlns:atom="http://www.w3.org/2005/Atom"
xml: base="http://www.example.org/book/978-0374292881">
<atom: link rel="self" href="/reviews?after=2009-08-15&sortbyAsc=date"/>
<atom: link rel="next" href="/reviews?after=2009-08-15&sortbyAsc=date&next=5"/>
<atom: link rel="http://www.example.org/rels/review" href="/book/review/03213"/>
<atom: link rel="http://www.example.org/rels/review" href="/book/review/03493"/>
<atom: link rel="http://www.example.org/rels/review" href="/book/review/04501"/>
<atom: link rel="http://www.example.org/rels/review" href="/book/review/04731"/>
<atom: link rel="http://www.example.org/rels/review" href="/book/review/04934"/>
</reviews>

ugodp  Jul 09, 2010 
Printed
Page 151
1st paragraph

"These are state-if-error and..." should read "These are stale-if-error and..."

Note from the Author or Editor:
"These are state-if-error and..." should read "These are stale-if-error and..."

MarkD  Jul 19, 2010 
Printed
Page 170
second # Response

The response header includes a If-Match: header which should be ETag

Note from the Author or Editor:
The name of the header in the PUT response must be "ETag" and not "If-Match".

David Biesack  Sep 26, 2013 
, Printed, PDF, ePub, Mobi, , Other Digital Version
Page 174
Paragraph right below "Solution" for section 10.7

The paragraphs reads:
"When the client is creating a new resource using PUT or the server has not returned If-
Modified-Since and/or ETag headers from a previous GET or PUT request to the resource,
make PUT requests as usual."

I think there is a typo. It should read (typo In capitals):

"When the client is creating a new resource using put or the server has not returned LAST-MODIFIED and/or etag headers from a previous get or put request to the resource,
make put requests as usual."

It should be "Last-Modified" the header returned form the server as opposed to "If-Modified-Since"

Hope this helps!

-Javier

Note from the Author or Editor:
When the client is creating a new resource using PUT or the server has not returned Last-Modified and/or Etag headers from a previous GET or PUT request to the resource,
make PUT requests as usual."

Javier Fernandez  Jul 25, 2014 
Printed
Page 187
Response in the example

'album' is mistyped as 'albmus' in both Location and Content-Location headers.

Note from the Author or Editor:
The Content-Location and Location in the response should appear as

Location: http: //www.example.org/albums/2009/08/1091
Content-Location: http://www.example.org/albums/2009/08/1091

ugodp  Jul 04, 2010 
Printed
Page 201
1st paragraph

"As of writing this book, the
specification that defines this method is a work in progress (see http://tools.ietf.org/html/
draft-dusseault-http-patch)."

The PATCH specification is no longer a work in progress. See RFC-5789 (http://tools.ietf.org/html/rfc5789).

Subbu Allamaraju
Subbu Allamaraju
 
Mar 29, 2010 
223
final paragraph, below "Solution"

There's an extra sentence fragment (or perhaps two sentences got merged badly) in the final sentence:

<< Once a user authorizes the client to access her resources, the server uses an
?access token? as an identifier uses the authorized client and uses a ?token secret? as
a shared secret.>>

This could be rewritten a few ways, e.g.., by replacing "uses the authorized client" with a comma.

Note from the Author or Editor:
The first paragraph in the Solution section should read as follows:

"Figure 12-1 shows the role of the OAuth protocol. At the start of the protocol, the server
uses a ?consumer key? as an identifier for the client and a? consumer secret? as a shared
secret. Once a user authorizes the client to access her resources, the server uses an
?access token? as an identifier and ?token secret? as a shared secret to access user's protected resources"

Larry West  Jul 04, 2010 
Printed
Page 231
Final paragraph

The final sentence reads " ... encrypt the data algorithms such as AES ... ". This should probably say " ... encrypt the data using algorithms such as AES ... ".

Note from the Author or Editor:
Thank you for pointing it out.

Adrian Wragg  May 22, 2012 
275
bottom

According to RFC4287, the URI of the image for <atom:icon> and <atom:logo> should be contained within the element content not specified by the (non-existent) "uri" attribute.

Note from the Author or Editor:
The examples in subsections titled atom:icon and atom:logo should read as follows:

<atom:icon>http://example.org/image/icon.png</atom:icon>
<atom:logo>http://example.org/image/logo.png</atom:logo>

Per RFC 4287, both these elements contain the URIs as text content.

Mike Glendinning  Sep 21, 2010