cipriansofronia / shopping-basket

Small REST shopping-basket API built in scala with Play Framework and Akka

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

shopping-basket Build Status

Small REST shopping-basket API built in scala with Play Framework and Akka

API

Get the entire catalog

GET /catalog

  • response:
    • body:
      [
          {
              "item": {
                  "id": "id123",
                  "name": "OnePlus3",
                  "vendor": "OnePlus",
                  "category": "phones",
                  "description": "the latest OnePlus smart phone",
                  "price": 1600
              },
              "stock": 2
          },
          ...
      ]
      
    • status: OK

Get the items for a specific basket

GET /basket

  • required headers: X-Basket-Idsome-random-basket-id
    • if X-Basket-Id header was not provided, than a new basket will be created and you'll get the new id in response as a header
  • response:
    • body:
          {
              "products": [
                  {
                      "id": "id123",
                      "name": "OnePlus3",
                      "vendor": "OnePlus",
                      "description": "the latest OnePlus smart phone",
                      "price": 1600,
                      "amount": 2
                  }
              ]
          }
          ```
      
    • status: OK.withHeader(X-Basket-Idsome-random-basket-id)

Add an item to basket

POST /basket/items

  • required headers: X-Basket-Idsome-random-basket-id
  • required body:
    {
        "itemId": "id123",
        "amount": 1
    }
    
  • response:
    • status: OK.withHeader(X-Basket-Idsome-random-basket-id)

Delete an item from basket

DELETE /basket/items/:itemId

  • required headers: X-Basket-Idsome-random-basket-id
  • response:
    • status: OK.withHeader(X-Basket-Idsome-random-basket-id)

About

Small REST shopping-basket API built in scala with Play Framework and Akka


Languages

Language:Scala 100.0%