2021-04-07-TIL

  • action 필드는 db에

1

2

(2+3)/2 => 2??!?

2 + 4

3 + 4

4 + 4

5 + 4

..

.

.

[GET] {server address}/cards

API Document

Card API

Card Create

  • Request
[POST] /api/cards
  • Response
{
		"cardId" : "{cardId}"
}

Card Read

  • Request
[GET] /api/cards
  • Response
{
		"cardId" : "{cardId}"
}

Card Update

  • Request
[PUT] /api/cards/{cardId}
  • Response
{
		"cardId" : "{cardId}"
}

Card Delete

  • Request
[DELETE] /api/cards/{cardId}
  • Response
{
		"cardId" : "{cardId}"
}

Item API

Item Create

  • Request
[POST] /api/items
  • Response
{
		"cardId" : "{cardId}"
}

Item Read

  • Request
[GET] /api/items
  • Response
{
		"cardId" : "{cardId}"
}

Item Update

  • Request
[POST] /api/items/{itemId}
  • Response
{
		"cardId" : "{cardId}"
}

Item Delete

  • Request
[DELETE] /api/items/{itemId}
  • Response
{
		"cardId" : "{cardId}"
}

History API

History Read

  • Request
[GET] /api/histories
  • Response
{
		"cardId" : "{cardId}"
}
  • History의 create는 서버에서 모든 api가 호출될 때 마다 호출되도록 구현
  • History의 update/delete는 불가능하도록 구현

References

REST API design with Spring

  • https://spring.io/guides/gs/rest-service/
  • https://spring.io/guides/tutorials/rest/

RESTful URL design

  • https://restfulapi.net/resource-naming/
  • https://digitalbourgeois.tistory.com/54
  • https://sanghaklee.tistory.com/57
  • https://apiguide.readthedocs.io/en/latest/build_and_publish/use_RESTful_urls.html

API Documentation

  • https://learning.postman.com/docs/publishing-your-api/documenting-your-api/
  • https://swagger.io/resources/articles/documenting-apis-with-swagger/