Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

문서 보기 API SPEC #100

Open
pyg410 opened this issue Oct 14, 2023 · 2 comments
Open

문서 보기 API SPEC #100

pyg410 opened this issue Oct 14, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@pyg410
Copy link
Collaborator

pyg410 commented Oct 14, 2023

문서 상세 조회 API SPEC

  • 사용자가 특정 문서를 조회한다.

Request

HTTP Method URI
GET /docs/{docs_id}

Response

Success

  • Status: 200 OK
  • Header
Name Value Description
content-type application/json JSON 
{
    "success": "true",
    "response": {
        "id": 1,
        "docsName": "업데이트1",
        "docsCategory": "카페",
        "docsLocation": {
            "lat": 35.17641341218037,
            "lng": 126.91349388159176
        },
        "docsContent": "문서 컨텐츠",
        "docsCreatedBy": "test",
        "docsCreatedAt": "2023/08/24 00:49:23",
        "scrap": "true"
    },
    "error": null
}

Fail

Status Description
404 NOT_FOUND 문서 없음
500 Internal Server Error unknown server error

404 NOT_FOUND

{
	"success" : false,
	"response" : null,
        "error": {
		"message": "존재하지 않는 문서입니다.",
		"status":404
	}
}
@pyg410 pyg410 added the documentation Improvements or additions to documentation label Oct 14, 2023
@BlackBean99
Copy link

  1. Internal Server Error가 BAD_REQUEST랑 컨벤션이 다르네요?

  2. 프론트 입장에서 success 로 필드를 한번 더 타야 하기 때문에 depth가 깊어지지 않게 설계하는 방법도 고려해보세요!

@pyg410
Copy link
Collaborator Author

pyg410 commented Oct 14, 2023

  1. 수정했습니다(400은 다시 추가해놓겠습니닷)
  2. success의 경우 꼭 필요하다고 생각한 이유가, 프론트가 직접 HTTP상태코드를 확인하고, 자체적으로 성공인지 여부를 판단할 수도 있겠지만, JSON 내에서 true/false의 boolean값만 판단하고 바로 response/error로 분기점을 만들 수 있어서 생산성이 더 높아지지 않을까 했습니다..!
    (실제로 카카오에서도 위의 문서와 유사한 형태로 API Response Format을 사용중입니다. 아래 링크 첨부했습니다~)
    (https://docs.kakaoi.ai/kakao_work/webapireference/commonguide/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants