Skip to content

API 문서

Minho Kim edited this page Feb 1, 2018 · 7 revisions

TagTalk WAS, Auth Server url 문서

API 문서

서버 API 문서

도메인

Server Domain
WAServer localhost:3030
Auth Server localhost:3000

로그인

HTTP Request Header

HTTP Header Value
Domain (Auth Server)
Method POST
URI Path /auth/local

HTTP Request Body

Body Key Value Format comment
uid (유저 아이디) String 유저 아이디
password (유저 패스워드) String 유저 패스워드

HTTP Response Header

HTTP Header Value
Content-Type application/json
Access-Control-Allow-Origin *
Access-Control-Allow-Headers origin, x-requested-with, content-type, accept

HTTP Response Body

Body Key Value Format comment
success true or false boolean 성공 여부
data {} Object 요청에 대한 응답 메세지
uid (유저 아이디) String 유저 아이디
email (유저 이메일) String 유저 이메일
token (토큰) String 엑세스 토큰 값

example

{
   success: true,
   data: {
      uid: "홍길동",
      email: "[email protected]",
      token: "(엑세스 토큰 값)"
   }
}

로그아웃

HTTP Request Header

HTTP Header Value
Domain (WasServer)
Method GET
URI Path /users/logout

HTTP Request Body

Nothing


HTTP Response Header

HTTP Header Value
Content-Type application/json

HTTP Response Body

Body Key Value Format comment
success true or false boolean 성공 여부
message <메세지 내용> String 요청에 대한 응답 메세지

example

{
   success: true,
   message: "로그아웃 완료!!"
}

회원가입

HTTP Request Header

HTTP Header Value
Domain (Auth Server)
Method POST
URI Path /auth/register

HTTP Request Body

Body Key Value
uid (유저 아이디)
password (유저 패스워드)
password2 (유저 패스워드)
email (유저 이메일)
age (나이)
gender male or female

HTTP Response Header

HTTP Header Value
Content-Type application/json
Access-Control-Allow-Origin *
Access-Control-Allow-Headers origin, x-requested-with, content-type, accept

HTTP Response Body

Body Key Value Format comment
success true or false boolean 성공 여부
data {} Object 요청에 대한 응답 메세지
uid (유저 아이디) String 유저 아이디
email (유저 이메일) String 유저 이메일
gender male or female String 성별
age (나이) Number 나이
token (토큰) String 엑세스 토큰 값

example

{
   success: true,
   data: {
      uid: "홍길동",
      email: "[email protected]",
      gender: male,
      age: "25",
      token: "(엑세스 토큰 값)"
   }
}

인기 검색어 리스트 받기

HTTP Request Header

HTTP Header Value
Domain (Auth Server)
Method POST
URI Path /popTag/hotlist

HTTP Request Body

Nothing


HTTP Response Header

HTTP Header Value
Content-Type application/json; charset=utf-8

HTTP Response Body

Body Key Value Format comment
_ [] Array 인기 검색어 배열
_ {} Object 인기 검색어 객체
name (인기검색어) String 인기 검색어
value (가중치 값) Number 인기 검색어 가중치 값

example

[
   {
      name: "인기방1",
      value: 50
   },
   {
      name: "인기방2",
      value: 39
   }, 
   ...
]

유저가 작성한 카드 리스트 받기

HTTP Request Header

HTTP Header Value
Domain (Auth Server)
Method GET
URI Path /users/card/
Cookie token="(토큰값)"
Query number="(읽어들인 카드 개수)"

HTTP Request Body

Nothing


HTTP Response Header

HTTP Header Value
Content-Type application/json; charset=utf-8

HTTP Response Body

Body Key Value Format comment
success true or false boolean 성공 여부
data [] Array 유저의 카드 데이터 Array
_ (카드 객체) Object 유저의 카드 객체
ObjectId (오브젝트 아이디) String mongoDB 카드 오브젝트 Id
user_ObjectId (오브젝트 아이디) String mongoDB 유저의 오브젝트 Id
card_id (카드 id) Number 카드 객체의 id
title (카드 제목) String 카드 객체의 제목
content (카드 내용) String 카드 객체의 내용
photo_path (카드 이미지 url) String 카드 객체 이미지의 url
register_time (카드 생성시간) Date 카드 객체의 생성시간
tag [(태그이름), ...] Array 카드 객체가 가진 태그의 배열

example

{
   successs: true,
   data : [
      {
         "ObjectId": "5a72892200301b1e04b69f12",
         "user_ObjectId": "5a6ebb805b78e0293882e237",
         "card_id": 26,
         "title": "닭장속에는 암탉이",
         "content": "꼬꼬댁 꼬꼬꼬꼬",
         "photo_path": "http://localhost:3030/images/uploads/김민호-1517455650120-35071-239710.jpg",
         "register_time": "2018-02-01T03:24:35.693Z",
         "tag": [
             "#암탉",
             "#귀여웡",
             "#닭"
         ]
      },
      ...
   ]
}

카드 작성하기

HTTP Request Header

HTTP Header Value
Domain (Auth Server)
Method POST
URI Path /users/card/
Cookie token="(토큰값)"
Query number="(읽어들인 카드 개수)"
Content-Type multipart/form

HTTP Request Body

Body Key Value
title (카드 제목)
content (카드 내용)
user_ObjectId (오브젝트Id)
tag [(태그), ...]
photo_path 사진

HTTP Response Header

HTTP Header Value
Content-Type application/json; charset=utf-8

HTTP Response Body

Body Key Value Format comment
success true or false boolean 성공 여부
data {} Object 유저의 카드 데이터 객체
card_id (카드 아이디) Number 카드 객체의 id

example

{
   successs: true,
   data : {
      card_id: 20
   }
}