Post

2021-04-07-TIL

2021-04-07-TIL

  • action 필드는 db에

1

2

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

2 + 4

3 + 4

4 + 4

5 + 4

..

.

.

1
[GET] {server address}/cards

API Document

Card API

Card Create

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

Card Read

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

Card Update

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

Card Delete

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

Item API

Item Create

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

Item Read

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

Item Update

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

Item Delete

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

History API

History Read

  • Request
1
[GET] /api/histories
  • Response
1
2
3
{
		"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/
This post is licensed under CC BY 4.0 by the author.