Skip to content

API 명세

Yunseo Hwang edited this page Dec 13, 2021 · 6 revisions
  • 최초 작성자: @Yunseo Hwang
  • 최초 작성일: 2021.11.02
  • 마지막 작성자: @Yunseo Hwang
  • 마지막 수정일: 2021.12.13
  • Description: API들의 형식을 기술합니다.

  • 🟦 : API
  • 🟩 : GET
  • 🟥 : POST
  • 🟧 : PUT
  • 🟫 : PATCH
  • ⬛ : DELETE

API 명세 목차는 화면 우측 상단의 Pages를 열어보면 확인할 수 있습니다.

🟦 Auth API

description: JWT 토큰 등 인증과 관련된 로직을 수행합니다.

🟥 POST api/auth

  • description : 로그인 정보를 받아 JWT 토큰을 반환합니다.

  • Request

    • Request Body :

      {
          "userId": string;
          "password": string;
      }
  • Response

    • Response Header

      Content-Type: "application/json"
      Set-Cookie: "X-Refresh-Token=[Refresh Token(JWT)]"
    • Response Body

      {
          "access": string;
      }

⬛ DELETE api/auth

  • description : cookie의 refresh token을 없애 로그아웃을 수행합니다.
  • Response
    • Response Header

      Set-Cookie: "" # cleared

🟩 GET api/auth

  • description : refresh token을 사용해 새로운 access token을 가져옵니다.

  • Request

    • Request Header :

      Cookie: "X-Refresh-Token=[Refresh Token(JWT)]"
  • Response

    • Response Header

      Content-Type: "application/json"
    • Response Body

      {
          "access": string;
      }

🟦 Users API

description: 사용자 관련된 CRUD 를 수행합니다.

🟩 GET api/users

  • description : idx(사용자 고유번호)를 사용해 사용자 정보를 가져옵니다.

  • Request

    • Request Query:

      {
          "uid": string; // Required
      }
  • Response

    • Response Header

      Content-Type: "application/json"
    • Response Body

      {
          "userId": string;
          "createdAt": string; // Date - ex) "2021-11-02T05:12:43.882Z",
          "updatedAt": string; // Date - ex) "2021-11-02T05:12:43.882Z"
      }

🟥 POST api/users

  • description : 새로운 사용자를 생성합니다.

  • Request

    • Request Body :

      {
          "userId": string;
          "password": string;
      }
  • Response

    • Response Header

      Content-Type: "application/json"
    • Response Body

      {
          "uid": string;
          **"createdAt": string; // Date - ex) "2021-11-02T05:12:43.882Z",
          "updatedAt": string; // Date - ex) "2021-11-02T05:12:43.882Z"
      }

🟦 Projects API

description: 프로젝트 관련된 CRUD 를 수행합니다.

🟩 GET api/projects

  • description : user가 등록한 프로젝트 목록을 가져옵니다.

  • Request

    • Request Header:

      {
          "authorization": string; // Required
      }
  • Response

    • Response Header

      Content-Type: "application/json"
    • Response Body

      {
          "projectList": [
              {
                  "id": number;
      	    "name": string;
      	    "clientId": string;
      	    "domain": "string | null";
              },
      	...
          ],
          "count": number;
      }

🟥 POST api/projects

  • description : 새로운 프로젝트를 생성합니다.

  • Request

    • Request Header:

      {
          "authorization": string; // Required
      }
    • Request Body :

      {
          "name": string; // Required
          "domain": string;
          "description": string;
      }
  • Response

    • Response Header

      Content-Type: "application/json"
    • Response Body

      {
          "id": number;
          "createdAt": string; // Date - ex) "2021-11-02T05:12:43.882Z",
          "updatedAt": string; // Date - ex) "2021-11-02T05:12:43.882Z"
      }

🟩 GET api/projects/:id

  • description : 프로젝트 id를 통해 프로젝트 정보를 가져옵니다.

  • Request

    • Request Header:

      {
          "authorization": string; // Required
      }
    • Request Param:

      {
          "id": number; // Required
      }
  • Response

    • Response Header

      Content-Type: "application/json"
    • Response Body

      {
          "id": number;
          "name": string;
          "clientId": string;
          "description": "string | null";
          "domain": "string | null";
          "image": "string | null";
          "question": "string | null";
          "createdAt": string; // Date - ex) "2021-11-02T05:12:43.882Z"
          "updatedAt": string; // Date - ex) "2021-11-02T05:12:43.882Z"
          "theme": {
      	"id": number;
      	"name": string;
          }
          "user": {
              "uid": string;
          }
      }

🟫 PATCH api/projects/:id

  • description : 프로젝트의 항목을 수정합니다.

  • Request

    • Request Header:

      Content-Type: "multipart/form-data"
    • Request Body:

      {
          "name": string;
          "description": string;
          "domain": string;
          "question": string;	
          "themeId": number;
          "image": File;
      }
  • Response

    • Response Header

      Content-Type: "application/json"
    • Response Body

      {
          "id": number;
          "createdAt": string; // Date - ex) "2021-11-02T05:12:43.882Z",
          "updatedAt": string; // Date - ex) "2021-11-02T05:12:43.882Z"
      }

⬛ DELETE api/projects/:id

  • description : 프로젝트를 삭제합니다.

  • Request

    • Request Header:

      {
          "authorization": string; // Required
      }
    • Request Param:

      {
          "id": number; // Required
      }
  • Response

    • Response Header

      Content-Type: "application/json"
    • Response Body

      {
          // 204 No Content
      }
Clone this wiki locally