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"
      }
      
  • 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"
      }
      
  • 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"
      }
      
  • 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"
      }
      
  • 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"
      }
      
  • Sample Call:

    DELETE /notice/599a5eb80abb413e0a7abff4/delete
    
  • Notes:

    none


โš ๏ธ **GitHub.com Fallback** โš ๏ธ