Skip to content

Instantly share code, notes, and snippets.

@mamund
Last active March 3, 2022 00:36
Show Gist options
  • Save mamund/31b5da15349e8bdef6bf62614410c923 to your computer and use it in GitHub Desktop.
Save mamund/31b5da15349e8bdef6bf62614410c923 to your computer and use it in GitHub Desktop.
README Mocking

Bookstore README Mocking

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?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