diff --git a/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java b/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java index f5be882..badab34 100644 --- a/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java +++ b/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java @@ -25,15 +25,23 @@ /// {account_id}/books private final HashMap> books = new HashMap<>(); - @Path("/{account_id}/books") - /// その人の本のタイトルとかを返す + /// その人の本のタイトルとかを返す + @Path("/{account_id}/books") @GET @Produces(MediaType.APPLICATION_JSON) public HashMap getBooks(@PathParam("account_id") String account_id){ return bookManager.getBooks(account_id); } + @Path("/{account_id}/books") + @POST + @Consumes(MediaType.APPLICATION_FORM_URLENCODED)//bodyに入力する値がある時 + public int createBook(@PathParam("account_id") String account_id, @FormParam("title") String title, @FormParam("color") String color, @FormParam("publicity") Boolean publicity) { + return bookManager.createBook(account_id, title, color, publicity); + } + + /// {account_id}/books/{book_id} @Path("/{account_id}/books/{book_id}")