Skip to content

Instantly share code, notes, and snippets.

@sjquant
Forked from iros/API.md
Last active April 28, 2019 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjquant/c212c9185b3d35533c7388e6d1a1440d to your computer and use it in GitHub Desktop.
Save sjquant/c212c9185b3d35533c7388e6d1a1440d to your computer and use it in GitHub Desktop.
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

    <The request type>

    GET | POST | DELETE | PUT

  • Headers

    <It can contain content type, authorization, etc>

  • URL Params

    <If URL params exist, specify them in accordance with name mentioned in URL section. Separate into optional and required. Document data constraints.>

    Required:

    id=[integer]

    Optional:

    photo_id=[alphanumeric]

  • Data Params

    <If making a post request, what should the body payload look like? URL Params rules apply here too.>

  • Success Response:

    <What should the status code be on success and is there any returned data? This is useful when people need to to know what their callbacks should expect!>

    • Code: 200
      Content: { id : 12 }
  • Error Response:

    <Most endpoints will have many ways they can fail. From unauthorized access, to wrongful parameters etc. All of those should be liste d here. It might seem repetitive, but it helps prevent assumptions from being made where they should be.>

    • Code: 401 UNAUTHORIZED
      Content: { error : "Log in" }

    OR

    • Code: 422 UNPROCESSABLE ENTRY
      Content: { error : "Email Invalid" }
  • Sample Call:

    <Just a sample call to your endpoint in a runnable format ($.ajax call or a curl request) - this makes life easier and more predictable.>

  • Notes:

    <This is where all uncertainties, commentary, discussion etc. can go. I recommend timestamping and identifying oneself when leaving comments here.>

회원가입

회원 가입 API

  • URL

    /v1/auth/sign-up

  • Method:

    POST

  • Headers

    Content-Type: application/json

  • URL Params

    None

  • Data Params

    Required:

    email=[string]: 이메일 형식의 문자열
    password=[string]: 8글자 이상의 비밀번호

    Optional:

    nickname=[string]

  • Success Response:

    • Code: 201
      Content:
      {
          "email": "test1234@test.co.kr",
          "id": "6889c71e-b269-4747-ad5e-5e741d2b82d1",
          "nickname": "COJClf",
          "photo": null
      }
      
  • Error Response:

    Not Yet

  • Sample Call:

    axios.post("/v1/auth/sign-up", {
      data: {
        email: "test123@test.co.kr",
        password: "123456789!!"
      }
    });
  • Notes:

    None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment