25.02.2015 Views

Introducing Spring Framework

Introducing Spring Framework

Introducing Spring Framework

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 12 ■ Exposing a REST API<br />

HTTP-PUT<br />

Next, let’s use the HTTP-PUT method to update a record. Again, you can use the CURL or the RESTClient add-on.<br />

Figure 12-4 shows the use of the RESTClient. Remember that for this you need to pass the ID and the JSON document.<br />

ID: 1acbb68a-a859-49c9-ac88-d9e9322bac55<br />

{<br />

"name": "Book Template 2.pdf",<br />

"location": "/docs/isfbook/Documents/Random/Book Template 2.pdf",<br />

"description": "A Book Template version 2"<br />

}<br />

Figure 12-4. RESTClient - http://localhost:8080/mydocuments/documents/1acbb68a-a859-49c9-ac88-d9e9322bac55<br />

After you press the Send button, you can test if it works by doing the same as Figure 12-2 and passing the ID<br />

1acbb68a-a859-49c9-ac88-d9e9322bac55.<br />

180

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!