Skip to content

rezins/spring-java-restful-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API SPEC

Authentication

All API must use this authentication

Request:

  • Header
    • X-Api-Ket : "your secret api key"

Create Product

Request:

  • Method : POST
  • Endpoint : /api/products
  • Header :
    • Content-Type : application/json
    • Accept : application/json

-Body

{
  "id" : "string, unique",
  "name" : "string",
  "price" : "long",
  "quantity" : "integer"
}

-Response

{
  "code" : "number",
  "status" : "string",
  "data" : {
      "id" : "string, unique",
      "name" : "string",
      "price" : "long",
      "quantity" : "integer",
      "createAt" : "date"
  }     
}

Get Product

Request:

  • Method : GET
  • Endpoint : /api/products/{id_product}
  • Header :
    • Content-Type : application/json
    • Accept : application/json

-Response

{
  "code" : "number",
  "status" : "string",
  "data" : {
      "id" : "string, unique",
      "name" : "string",
      "price" : "long",
      "quantity" : "integer",
      "createAt" : "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, unique",
      "name" : "string",
      "price" : "long",
      "quantity" : "integer",
      "createdAt" : "date",
      "updatedAt" : "date"
  }     
}

List Product

Request:

  • Method : POST
  • Endpoint : /api/products
  • Header :
    • Content-Type : application/json
    • Accept : application/json
  • Query Param :
    • size : number,
    • page : number

-Response

{
  "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"
      }     
  ] 
}

Delete Product

Request:

  • Method : DELETE
  • Endpoint : /api/products/{id_product}
  • Header :
    • Content-Type : application/json
    • Accept : application/json

-Response -Response

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

About

Spring RESTful API Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages