An open API service indexing awesome lists of open source software.

https://github.com/erikrios/kotlin-restful-api

Learn to Build a RESTful API with Spring Framework
https://github.com/erikrios/kotlin-restful-api

kotlin postgresql postgresql-driver rest-api restful-api spring-boot spring-data-jpa spring-framework spring-validation spring-web-mvc

Last synced: 3 months ago
JSON representation

Learn to Build a RESTful API with Spring Framework

Awesome Lists containing this project

README

          

# API Spec

## Authentication

All API must use this authentication

Request :
- Header
- Api-Key : "your secret api key"

## Create Product

Request :
- Method : POST
- Endpoint : `/api/products`
- Header
- Content-Type : applicatication/json
- Accept: application/json
- Body :

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

Response :

```json
{
"code": "number",
"status": "string",
"data": {
"id": "string, 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 :

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

## Update Product

Request :
- Method : PUT
- Endpoint : `/api/products/{id_product}`
- Header
- Content-Type : applicatication/json
- Accept: application/json
- Body :

```json
{
"name": "string",
"price": "long",
"quantity": "integer"
}
```

Response :

```json
{
"code": "number",
"status": "string",
"data": {
"id": "string, 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 :

```json
{
"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
- Accept: application/json

Response :

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