Skip to content

Instantly share code, notes, and snippets.

@mamund
Created March 3, 2022 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mamund/f93f467b03d3dd7b2ca10b06be8db98b to your computer and use it in GitHub Desktop.
Save mamund/f93f467b03d3dd7b2ca10b06be8db98b to your computer and use it in GitHub Desktop.
CWAD-46-README-Mocking-Bookstore-API

Bookstore README Mocking

Simple README Mock for the Bookstore API

listBooks()

*** REQUEST ***
GET /books
Accept: application/json

*** RESPONSE ***
200 OK
Content-Type: application/json

{ "books" : [
    {"bookId":"123", isbn: "...". "title":"Nice Book", "authors": [ {"authorId":"abc", "fullName":"Sally Writer"} ] },
    {"bookId":"456", isbn: "...". "title":"Good Book", "authors": [ {"authorId":"def", "fullName":"Susan Pen"} ] },
    {"bookId":"789", isbn: "...". "title":"Great Book", "authors": [ {"authorId":"ghi", "fullName":"Sandra Reporter"} ] }
  ]
}

searchBooks()

*** REQUEST ***
GET /books/search?searchQuery=Great
Accept: application/json

*** RESPONSE ***
200 OK
Content-Type: application/json

{ "books" : [
    {"bookId":"789", isbn: "...". "title":"Great Book", "authors": [ {"authorId":"ghi", "fullName":"Sandra Reporter"}]}
  ]
}

addItemToCart()

*** REQUEST ***
POST /carts/q1w2e3/items
Content-Type: application/json

{"bookId":"789", "quantity":"1"}

*** RESPONSE ***
201 Create
Location: /carts/q1w2e3
  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment