API_Notice - Laterality/yummy-dishes-REST GitHub Wiki
Index
- ๊ณต์ง์ฌํญ ๋ฑ๋ก
- ๊ณต์ง์ฌํญ ์กฐํ
- ๊ณต์ง์ฌํญ ๋ฆฌ์คํธ ์กฐํ
- ๊ณต์ง์ฌํญ ๊ฐฑ์
- ๊ณต์ง์ฌํญ ์ ๊ฑฐ
๊ณต์ง์ฌํญ๋ฅผ ๋ฑ๋กํ๋ API์ ๋๋ค.
-
URL
/notice/register
-
Method:
POST
-
URL Params
none
-
Data Params
Body
- title
- string
- ๊ณต์ง์ฌํญ๋ช
- category
- string
- ๊ณต์ง์ฌํญ ์ข ๋ฅ
- content
- string
- ๊ณต์ง์ฌํญ ๋ด์ฉ
- author
- ๊ณต์ง์ฌํญ ์์ฑ์์ "_id" ํ๋๊ฐ
-
Success Response:
-
Code: 201
Content:{ "result": "ok", "notice": { ... } }
- result
- string
- ์์ฒญ์ ๋ํ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ["ok", "fail", "error"]
- message
- string
- ์ฒ๋ฆฌ ๊ฒฐ๊ณผ์ ๋ํ ์ถ๊ฐ ๋ฉ์์ง
- notice
- NoticeModel
- ์์ฒญ์ด ์ฑ๊ณตํ ๊ฒฝ์ฐ ์์ฑ๋ ๊ณต์ง์ฌํญ ์ ๋ณด
-
-
Error Response:
-
Code: 405 INVALID PARAMETERS
Content:{ "result": "fail", "message": "invalid parameters" }
OR
-
Code: 500 SERVER FAULT
Content:{ "result": "error", "message": "server fault" }
-
Code: 405 INVALID PARAMETERS
-
Sample Call:
{ "title": "notice title1", "category": "๊ณต์ง", "content": "some notice content", "author": "..." }
-
Notes:
- ๊ณต์ง์ฌํญ ์์ฑ์ ๊ด๋ฆฌ์ ๊ถํ(is_admin == true)์ ๊ฐ์ง ์ฌ์ฉ์๋ง ๊ฐ๋ฅํฉ๋๋ค.
๋จ์ผ ๊ณต์ง์ฌํญ์ ์กฐํํ๋ API์ ๋๋ค.
-
URL
/notice/{noticeId}
-
Method:
GET
-
URL Params
- noticeId
- string
- ์กฐํํ ๊ณต์ง์ฌํญ์ "_id" ํ๋๊ฐ
-
Data Params
none
-
Success Response:
-
Code: 200
Content:{ "result": "ok", "notice": { ... } }
- result
- string
- ์์ฒญ์ ๋ํ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ["ok", "fail", "error"]
- message
- string
- ์ฒ๋ฆฌ ๊ฒฐ๊ณผ์ ๋ํ ์ถ๊ฐ ๋ฉ์์ง
- categories
- NoticeModel
- ์กฐํ๋ ๊ณต์ง์ฌํญ
-
-
Error Response:
-
Code: 404 NOT FOUND
Content:{ "result": "fail", "message": "not found(notice)" }
OR
-
Code: 500 SERVER FAULT
Content:{ "result": "error", "message": "server fault" }
-
Code: 404 NOT FOUND
-
Sample Call:
GET /notice/...
-
Notes:
None
๋ ์ง ๋ฒ์๋ก ๊ณต์ง์ฌํญ ๋ฆฌ์คํธ๋ฅผ ์กฐํํ๋ API์ ๋๋ค.
-
URL
/notice/notices
-
Method:
GET
-
URL Params
Required:
- from
- Date
- ์กฐํ ๋ฒ์ ์์ ๋ ์ง
- to
- Date
- ์กฐํ ๋ฒ์ ๋ ๋ ์ง
Optional:
- from
- string
- ์กฐํ ๋ฒ์ ์์ ๋ ์ง(๊ธฐ๋ณธ๊ฐ: ์ค๋)
- to
- string
- ์กฐํ ๋ฒ์ ๋ ๋ ์ง(๊ธฐ๋ณธ๊ฐ: ์ค๋)
-
Data Params
none
-
Success Response:
-
Code: 200
Content:{ "result": "ok", "notices": [ ... ] }
- result
- string
- ์์ฒญ์ ๋ํ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ["ok", "fail", "error"]
- message
- string
- ์ฒ๋ฆฌ ๊ฒฐ๊ณผ์ ๋ํ ์ถ๊ฐ ๋ฉ์์ง
- notices
- NoticesModel
- ์กฐํ๋ ๊ณต์ง์ฌํญ ๋ฐฐ์ด
-
-
Error Response:
-
Code: 405 INVALID PARAMETERS
Content:
{ "result": "fail", "message": "invalid parameters" }
OR
-
Code: 500 SERVER FAULT
Content:{ "result": "error", "message": "server fault" }
-
Code: 405 INVALID PARAMETERS
Content:
-
Sample Call:
GET /notice/notices?from=2017-09-18&to=2017-09-21
-
Notes:
- ๋ ์ง ํ์์ "yyyy-mm-dd"์ ๋๋ค.
๊ณต์ง์ฌํญ๋ฅผ ๊ฐฑ์ ํ๋ API์ ๋๋ค.
-
URL
/notice/{noticeId}/update
-
Method:
PUT
-
URL Params
Required:
- noticeId
- string
- ๊ณต์ง์ฌํญ์ "_id" ํ๋
-
Data Params
Body
- title
- string
- ์ ๋ฐ์ดํธํ ๊ณต์ง์ฌํญ ์ ๋ชฉ
- category
- string
- ์ ๋ฐ์ดํธํ ๊ณต์ง์ฌํญ ์ ํ
- content
- string
- ์ ๋ฐ์ดํธํ ๊ณต์ง์ฌํญ ๋ด์ฉ
-
Success Response:
-
Code: 200
Content:{ "result": "ok" }
- result
- string
- ์์ฒญ์ ๋ํ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ["ok", "fail", "error"]
- message
- string
- ์ฒ๋ฆฌ ๊ฒฐ๊ณผ์ ๋ํ ์ถ๊ฐ ๋ฉ์์ง
-
-
Error Response:
-
Code: 404 NOT FOUND
Content:
{ "result": "fail", "message": "not found" }
OR
-
Code: 405 INVALID PARAMETERS
Content:
{ "result": "fail", "message": "invalid parameters" }
OR
-
Code: 500 SERVER FAULT
Content:{ "result": "error", "message": "server fault" }
-
Code: 404 NOT FOUND
Content:
-
Sample Call:
{ "title": "Changed notice title" }
-
Notes:
None
๊ณต์ง์ฌํญ๋ฅผ ์ ๊ฑฐํ๋ API์ ๋๋ค.
-
URL
/notice/{noticeId}/delete
-
Method:
DELETE
-
URL Params
Required:
- noticeId
- string
- ๊ณต์ง์ฌํญ์ "_id" ํ๋
-
Data Params
none
-
Success Response:
-
Code: 200
Content:{ "result": "ok" }
- result
- string
- ์์ฒญ์ ๋ํ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ["ok", "fail", "error"]
- message
- string
- ์ฒ๋ฆฌ ๊ฒฐ๊ณผ์ ๋ํ ์ถ๊ฐ ๋ฉ์์ง
-
-
Error Response:
-
Code: 404 NOT FOUND
Content:
{ "result": "fail", "message": "not found" }
OR
-
Code: 500 SERVER FAULT
Content:{ "result": "error", "message": "server fault" }
-
Code: 404 NOT FOUND
Content:
-
Sample Call:
DELETE /notice/599a5eb80abb413e0a7abff4/delete
-
Notes:
none