Aditprayogo / ecom-rest-api

Create RESTful api using Spring boot (Kotlin) + PostgreSQL + Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API SPEC

Authentication

All API must use this Authentication

Request :

  • Header :
    • X-Api-Key : "Your secret api"

Create Product

Request :

  • Method : POST

  • Endpoint : /api/products

  • Header :

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

{
  "id" : "String, id product, unique",
  "name" : "String",
  "price" : "long",
  "quantity" : "integer"
}
  • Response :
{
  "code" : "number",
  "status" : "string",
  "data" : {
      "id" : "String, id product, unique",
      "name" : "String",
      "price" : "long",
      "quantity" : "integer",
      "createdAt" : "date",
      "updatedAt" : "date"
  }
}

Get Product

Request :

  • Method : GET

  • Endpoint : /api/products/{id_product}

  • Header :

    • Accept : application/json
  • Response :

{
  "code" : "number",
  "status" : "string",
  "data" : {
      "id" : "String, id product, unique",
      "name" : "String",
      "price" : "long",
      "quantity" : "integer",
      "createdAt" : "date",
      "updatedAt" : "date"
  }
}

Update Product

Request :

  • Method : PUT
  • Endpoint : /api/products/{id_product}
  • Header :
    • Content-Type : application/json
    • Accept : application/json
  • Body :
{
  "name" : "String",
  "price" : "long",
  "quantity" : "integer"
}
  • Response :
{
  "code" : "number",
  "status" : "string",
  "data" : {
      "id" : "String, id product, unique",
      "name" : "String",
      "price" : "long",
      "quantity" : "integer",
      "createdAt" : "date",
      "updatedAt" : "date"
  }
}

List Product

Request :

  • Method : GET

  • Endpoint : /api/products

  • Header :

    • Accept : application/json
  • Query Param :

    • size : number,
    • page : number
  • Response :

{
  "code" : "number",
  "status" : "string",
  "data" : [
        {
            "id" : "String, id product, unique",
            "name" : "String",
            "price" : "long",
            "quantity" : "integer",
            "createdAt" : "date",
            "updatedAt" : "date"
        },
        {
            "id" : "String, id product, unique",
            "name" : "String",
            "price" : "long",
            "quantity" : "integer",
            "createdAt" : "date",
            "updatedAt" : "date"
        }
        
  ]
}

Delete Product

Request :

  • Method : DELETE

  • Endpoint : /api/products/{id_product}

  • Header :

    • Accept : application/json
  • Response :

{
  "code" : "number",
  "status" : "string"
}

About

Create RESTful api using Spring boot (Kotlin) + PostgreSQL + Docker


Languages

Language:Kotlin 99.9%Language:Dockerfile 0.1%