Skip to content

kharisma-wardhana/kotlin_restfulapi

Repository files navigation

API Spec

Create Product

Request:

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

Get Product

Request:

  • Method : GET
  • Endpoint : /api/products/{product_id}
  • Header :
    • Accept : application/json
  • Response :
{ 
  "code": "number",
  "status": "string",
  "data": { 
            "id" : "string, unique",
            "name" : "string",
            "price" : "long",
            "quantity": "integer",
            "createdAt": "date",
            "updatedAt": "date" },
  "message": "string"
}

Update Product

Request:

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

List Product

Request:

  • Method : GET
  • Endpoint : /api/products/
  • Header :
    • Accept : application/json
  • Query Param:
    • size : number
    • page : number
  • Body :
{ 
  "code": "number",
  "status": "string",
  "data": [{ 
            "id" : "string, unique",
            "name" : "string",
            "price" : "long",
            "quantity": "integer",
            "createdAt": "date",
            "updatedAt": "date" },
            { 
            "id" : "string, unique",
            "name" : "string",
            "price" : "long",
            "quantity": "integer",
            "createdAt": "date",
            "updatedAt": "date" }],
  "message": "string"
}
  • Response :
{ 
  "code": "number",
  "status": "string",
  "data": { 
            "id" : "string, unique",
            "name" : "string",
            "price" : "long",
            "quantity": "integer",
            "createdAt": "date",
            "updatedAt": "date" },
  "message": "string"
}

Delete Product

Request:

  • Method : DELETE
  • Endpoint : /api/products/{product_id}
  • Header :
    • Accept : application/json
  • Response :
{ 
  "code": "number",
  "status": "string",
  "message": "string"
}

About

Learn Kotlin RESTful API (springboot kotlin)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages