Skip to content
Justin edited this page Aug 22, 2013 · 59 revisions

특징

  • Post의 경우 request body는 JSON으로 한다.
  • Authentication 정보는 HTTP Header에 같이 보낸다.
  • 모든 통신은 HTTPS로 한다.

서버 정보

종류 Host
상용 api.plattr.com

Authentication

다음 parameter를 HTTP Header에 실어서 보낸다.

Name Value
X-APP-KEY 게임에 발급된 app key. 모든 API 호출에 필요.
X-AUTH-UUID 디바이스 고유의 UUID. 모든 API 호출에 필요.
안드로이드의 경우에는 설치 직후 UUID를 생성하여 넘겨준다.(권고사항)
X-AUTH-TOKEN 서버에서 발급한 인증 token. 사용자 식별이 필요한 API호출에 필요
로그인 API를 호출하면 응답결과로 받음

API List

Anonymous 로그인

게임 클라이언트가 시작되고, 로그인을 위해 서버로 호출하는 함수

  • Path: /v1/auth/anonymous
  • Authentication Header: X-APP-KEY, X-AUTH-UUID
  • Method: GET
  • Parameter:
Name Type Description
fields Array of String 로그인 후 가져와야할 사용자 데이터 목록
  • Request URI Example:

http://[server-url]/v1/auth/anonymous?fields=level&fields=score&fields=friends_count

  • Response Body: JSON
Name Type Description
result_code Number Error Code 참고
result_message Option[String] 실패한 경우에 메시지 있을 수 있음
data JSON Object
access_token String 로그인한 사용자를 위한 access token
fields JSON data fields에 명시된 사용자 데이터들을 json 형태로 반환
  • Response Body Example:
{
    "result_code": 0,
    "data": {
        "access_token": "iuojsdof-SDFSDF-sdf24-123",
        "fileds": [
            {
                "key": "user_data_key1",
                "value": "value1"
            },
            {
                "key": "user_data_key2",
                "value": "value22"
            }
        ]
    }
}

Naver 로그인

게임 클라이언트가 시작되고, 로그인을 위해 서버로 호출하는 함수

  • Path: /v1/auth/naver/:naver_access_token
  • Authentication Header: X-APP-KEY, X-AUTH-UUID
  • Method: GET
  • Parameter:
Name Type Description
naver_access_token String 네이버 로그인 후 발급 받은 access token
fields Array of String 로그인 후 가져와야할 사용자 데이터 목록
  • Response Body: JSON
Name Type Description
result_code Number Error Code 참고
result_message Option[String] 실패한 경우에 메시지 있을 수 있음
data JSON Object
access_token String 로그인한 사용자를 위한 access token
fields JSON data fields에 명시된 사용자 데이터들을 json 형태로 반환

User 데이터 저장

  • Path: /v1/data
  • Authentication Header: X-APP-KEY, X-AUTH-UUID, X-AUTH-TOKEN
  • Method: POST
  • Request Body: JSON array로 다음과 같은 JSON object들 포함
key String data의 key
value String data의 value
command Option[String] 'set', 'inc', 'dec' 중 하나.
Default는 set
'inc'나 'dec'인 경우에 value의 string은 number로 전환 가능하여야 함
  • Request Body Example
[
      {
          "key": "key1",
          "value": "value1",
          "command": "inc"
      },
      {
          "key": "key2",
          "value": "value2"
      }
  ]
  • Response Body: JSON
Name Type Description
result_code Number Error Code 참고
result_message Option[String] 실패한 경우에 메시지 있을 수 있음

User 데이터 얻어오기

  • Path: /v1/data/

  • Authentication Header: X-APP-KEY, X-AUTH-UUID, X-AUTH-TOKEN

  • Method: GET

  • Parameters:

    Name Type Description
    keys Array of String 얻어오고자 아는 User 데이터의 key 목록
  • Request URI Example:

http://[server-url]/v1/data?keys=level&keys=score&keys=friends_count

  • Response Body: JSON
Name Type Description
result_code Number Error Code 참고
result_message Option[String] 실패한 경우에 메시지 있을 수 있음
data JSON Array
key String data의 key
value String data의 value
  • Response Body Example:
{
    "result_code": 0,
    "data": [
        {
            "key": "key1",
            "value": "value1"
        },
        {
            "key": "key2",
            "value": "value2"
        }
    ]
}

Mailbox 아이템 생성

  • Path: /v1/mailbox
  • Authentication Header: X-APP-KEY, X-AUTH-UUID, X-AUTH-TOKEN
  • Method: POST
  • Request Body:
Name Type Description
content String 내용
  • Response Body: JSON
Name Type Description
result_code Number Error Code 참고
result_message Option[String] 실패한 경우에 메시지 있을 수 있음
id Number 추가된 mail의 id

Mailbox 내용 얻어오기

  • Path: /v1/mailbox
  • Authentication Header: X-APP-KEY, X-AUTH-UUID, X-AUTH-TOKEN
  • Method: GET
  • Parameters:
Name Type Description
after_mail_id Option[Number] after_id 다음 것부터 얻어옴
이 id부터 descending임
limit Number 가져올 최대 개수. default는 10개
  • Response Body: JSON으로 다음과 같은 결과값 리턴
Name Type Description
result_code Number Error Code 참고
result_message Option[String] 실패한 경우에 메시지 있을 수 있음
data JSON Object
Name Type Description
id Number mail의 id
content String json 형식을 따르는 임의의 데이터.
{
    "result_code": 0,
    "data": [
        {
            "id": 1235324,
            "content": "\"title\": \"선물이도착했어요~\",\"body\": \"별이1개지급되었습니다\", \"read\": true, \"expires_at\":\"2013/11/30T00: 00: 00+0000\" }"
        },
        {
            "id": 1235320,
            "content": "\"title\": \"메시지가 왔습니다~~\",\"body\": \"1월1일 점수가 리셋됩니다.\", \"read\": true, \"expires_at\":\"2013/11/30T00: 00: 00+0000\" }"
        }
    ]
}

Mailbox 아이템 1개 내용 업데이트

  • Path: /v1/mailbox/:id

  • Authentication Header: X-APP-KEY, X-AUTH-UUID, X-AUTH-TOKEN

  • Method: PUT

  • Request Body:

    Name Type Description
    content String 새롭게 갱신할 데이터
  • Response Body: JSON으로 다음과 같은 결과값 리턴

Name Type Description
result_code Number Error Code 참고
result_message Option[String] 실패한 경우에 메시지 있을 수 있음

Mailbox 아이템 1개 삭제

  • Path: /v1/mailbox/:id
  • Authentication Header: X-APP-KEY, X-AUTH-UUID, X-AUTH-TOKEN
  • Method: DELETE
  • Request Body:없음
  • Response Body: JSON으로 다음과 같은 결과값 리턴
Name Type Description
result_code Number Error Code 참고
result_message Option[String] 실패한 경우에 메시지 있을 수 있음

Mailbox 아이템 모두 삭제

해당 user_id에 속한 메일 item을 모두 삭제한다. 현재는 1,000개까지 한번에 삭제하는 걸로 제한이 걸려있으므로 유의.

  • Path: /v1/mailbox
  • Authentication Header: X-APP-KEY, X-AUTH-UUID, X-AUTH-TOKEN
  • Method: DELETE
  • Request Body:없음
  • Response Body: JSON으로 다음과 같은 결과값 리턴
Name Type Description
result_code Number Error Code 참고
result_message Option[String] 실패한 경우에 메시지 있을 수 있음

Score 저장하기

Not implemented !!!

Leaderboard 조회

Not implemented !!!

게임 전체 유저 대상의 leaderboard를 조회

  • Path: /v1/leaderboard/global
  • Authentication Header: X-APP-KEY, X-AUTH-UUID, X-AUTH-TOKEN
  • Method: GET
  • Parameters:
Name Type Description
min_score Number
max_score Number
order String 'ascending' 'descending' 'neighbor'
limit Number 가져올 최대 개수. default는 10개

Error Code

Value Description
0 Success
1001 Invalid parameter
1002 Data dose not exist
9999 Unknown error

Clone this wiki locally