Sale - up1/soa_group2 GitHub Wiki

Get list items that selling.

Requset Format

GET /sale

Header

  • Accept: "application/json"

Respone Format

Header

  • content-type: "application/json"
  • status: 200

Body

[
  {
    "id": "58cac2579e14bee8beb14cea",
    "name": "Nokia Avenger 4000",
    "detail": "Captain Swear Police edition",
    "price": 10900,
    "amount": 420,
    "owner": "Stan Lee",
    "saleDate": 1489683031,
    "editDate": null,
    "category": {
      "id": "58cac2019e14bee8beb14ce9",
      "name": "Electronic Accessory",
      "parents": [
        "Mobile and Tablet"
      ],
      "children": null
    }
  },
  {
    "id": "58cac2eb9e14c9dffb575c49",
    "name": "Samsung S7 plus",
    "detail": "Mobile Ultimate Function",
    "price": 25000,
    "amount": 170,
    "owner": "Kee Lim",
    "saleDate": 1489683179,
    "editDate": null,
    "category": {
      "id": "58cac2019e14bee8beb14ce9",
      "name": "Electronic Accessory",
      "parents": [
        "Mobile and Tablet"
      ],
      "children": null
    }
  },
  {
    "id": "58cac35b9e14c9dffb575c4a",
    "name": "OPPA GALAXY",
    "detail": "Smartphone gangnam style",
    "price": 14000,
    "amount": 721,
    "owner": "Pha Yoot",
    "saleDate": 1489683291,
    "editDate": null,
    "category": {
      "id": "58cac2019e14bee8beb14ce9",
      "name": "Electronic Accessory",
      "parents": [
        "Mobile and Tablet"
      ],
      "children": null
    }
  }
]

Get selling item information.

Requset Format

GET /sale/{id}

Header

  • Accept: "application/json"

Respone Format

Header

  • content-type: "application/json"
  • Status: 200

Body

{
  "id": "58cac2579e14bee8beb14cea",
  "name": "Nokia Avenger 4000",
  "detail": "Captain Swear Police edition",
  "price": 10900,
  "amount": 420,
  "owner": "Stan Lee",
  "saleDate": 1489683031,
  "editDate": null,
  "category": {
    "id": "58cac2019e14bee8beb14ce9",
    "name": "Electronic Accessory",
    "parents": [
      "Mobile and Tablet"
    ],
    "children": null
  }
}

Get a list of products base on category.

Requset Format

GET /sale/category/{categoryName}

Header

  • Accept: "application/json"

Respone Format

Header

  • content-type: "application/json"
  • Status: 200

Body

[
  {
    "id": "58cac2579e14bee8beb14cea",
    "name": "Nokia Avenger 4000",
    "detail": "Captain Swear Police edition",
    "price": 10900,
    "amount": 420,
    "owner": "Stan Lee",
    "saleDate": 1489683031,
    "editDate": null,
    "category": {
      "id": "58cac2019e14bee8beb14ce9",
      "name": "Electronic Accessory",
      "parents": [
        "Mobile and Tablet"
      ],
      "children": null
    }
  },
  {
    "id": "58cac2eb9e14c9dffb575c49",
    "name": "Samsung S7 plus",
    "detail": "Mobile Ultimate Function",
    "price": 25000,
    "amount": 170,
    "owner": "Kee Lim",
    "saleDate": 1489683179,
    "editDate": null,
    "category": {
      "id": "58cac2019e14bee8beb14ce9",
      "name": "Electronic Accessory",
      "parents": [
        "Mobile and Tablet"
      ],
      "children": null
    }
  },
  {
    "id": "58cac35b9e14c9dffb575c4a",
    "name": "OPPA GALAXY",
    "detail": "Smartphone gangnam style",
    "price": 14000,
    "amount": 721,
    "owner": "Pha Yoot",
    "saleDate": 1489683291,
    "editDate": null,
    "category": {
      "id": "58cac2019e14bee8beb14ce9",
      "name": "Electronic Accessory",
      "parents": [
        "Mobile and Tablet"
      ],
      "children": null
    }
  },
  {
    "id": "58cf7830f09e2a5ddf250854",
    "name": "Mobile Null",
    "detail": "Product out of stock",
    "price": 14000,
    "amount": 0,
    "owner": "Mister None",
    "saleDate": 1489991728,
    "editDate": null,
    "category": {
      "id": "58cac2019e14bee8beb14ce9",
      "name": "Electronic Accessory",
      "parents": [
        "Mobile and Tablet"
      ],
      "children": null
    }
  }
]

Create new shopping cart

Requset Format

POST /cart

Header

  • Accept: "application/json"

Respone Format

Header

  • content-type: "application/json"
  • Status: 200

Body

{
    "58e2b08cfa559cc1cb4d99e3"
}

Create new shopping cart

Requset Format

POST /cart/{cartId}

Header

  • Accept: "application/json"

Respone Format

Header

  • content-type: "application/json"
  • Status: 200

Body

{
    "58e2b08cfa559cc1cb4d99e3"
}

Get cart information

Requset Format

GET /cart/{cartId}

Header

  • Accept: "application/json"

URL

  • /cart/58cf96c3177c9ec466a52683?productId=58cd1fb00153fb8a198c3887&amount=10

Respone Format

Header

  • content-type: "application/json"
  • Status: 200

Body

{  
    "id": "58e2c8acfa559cc1cb4d99e4",  
    "cartType": 0,  
    "ownerName": "anonymous",  
    "products": [  list of products  ],
    "createDate": 1491257516
}

Update item in cart

Requset Format

PUT /cart/{cartId}

Header

  • Accept: "application/json"

Body

 {  
    "id": "58e2c8acfa559cc1cb4d99e4",  
    "cartType": 0,  
    "ownerName": "anonymous",  
    "products": [  list of products  ],
    "createDate": 1491257516
}

Respone Format

Header

  • content-type: "application/json"
  • Status: 200

Create salehistory.

Request Format

POST /salehistory

Header

  • Accept: "application/json"
  • Content-Type: "application/json"

Body

{
    "id" : "1",
    "buyer" : "supphawit",
    "totalPrice" : "70000",
    "buyDate" : "123213231",
    "paidDate" : "123213231",
    "payScheduled" : "123299631",
    "buyProducts" : [
        {
            "id" : "213",
            "name" : "Iphone 7 Plus 64 GB",
            "detail" : "Lastest Apple's Product. I just use it for 7 days",
            "price" : "30000",
            "amount" : "1",
            "owner" : "kanathips",
            "saleDate" : "123213231",
            "editDate" : "123123123",
            "category" : {"current" : "Smart Phone", "parent" : ["IT"] }
        },
        {
            "id" : "214",
            "name" : "Iphone 8 Plus 128 GB",
            "detail" : "Lastest Apple's Product. I just use it for 7 days",
            "price" : "40000",
            "amount" : "1",
            "owner" : "kanathips",
            "saleDate" : "123213231",
            "editDate" : "123123123",
            "category" : { "current" : "Smart Phone", "parent" : ["IT"] }
        } 
    ],
    "deliveryAddress" : "87 หมู่ 10 ตำบลนครปฐม อำเภอเมือง จังหวัด นครปฐม 73000",
    "payStatus" : 0,
    "tel" : "0832926881",
    "email" : "[email protected]"
}

Respone Format

Header

  • content-type: "application/json"
  • status: 201

Body

[
  "58e23c27f09ebb97c551426a",
  "58e23c27f09ebb97c551426b"
]

Get a sale history of selected member.

Request Format

GET /salehistory/member/{owner}

Header

  • Accept: "application/json"

Response Format

Header

  • content-type: "application/json"
  • Status: 200

Body

[ {
    "id": "58e2317bf09ebb97c5514268",
    "product_id": "213",
    "owner": "kanathips",
    "ponumber": "1",
    "amount": 1,
    "date": 1491218811,
    "buyer": "supphawit"
  },
  {
    "id": "58e2317bf09ebb97c5514269",
    "product_id": "214",
    "owner": "kanathips",
    "ponumber": "1",
    "amount": 1,
    "date": 1491218811,
    "buyer": "supphawit"
  }
]

Get a product's sale history.

Request Format

GET /salehistory/product/{productId}

Header

  • Accept: "application/json"

Response Format

Header

  • content-type: application/json
  • Status: 200

Body

[
  {
    "id": "58e2317bf09ebb97c5514269",
    "product_id": "214",
    "owner": "kanathips",
    "ponumber": "1",
    "amount": 1,
    "date": 1491218811,
    "buyer": "supphawit"
  }
]