[GET] Get User

사용자 식별자를 사용해 존재하는 사용자의 정보를 가져올 수 있습니다.

Request

URL

GET https://api.asleep.ai/ai/v1/users/{user_id}

Header

FieldTypeRequiredDescription
x-api-keyStringOAPI Key

Path Parameter

FieldTypeRequiredDescription
user_idStringOuser id

Example

curl "https://api.asleep.ai/ai/v1/users/{user_id}" -X GET \
  -H "x-api-key: <YOUR_API_KEY>"

Response

200 OK

  • 사용자 정보 획득 성공

Body (result field)

FieldTypeDescription
user_idStringuser id
to_be_deletedBoolean삭제 대기 여부
last_session_infoSession Object or null마지막 세션 정보
metadataMetadata Object or null사용자 메타 정보

Session Object

if state == OPEN: session_end_time은 null

if state != COMPLETE: complete_end_time은null

Field

Type

Description

session_id

String

session id

inference_type

String

세션에 업로드한 오디오 데이터의 형태

service

String

세션 생성 시 지정한 서비스 이름

start_time

String (YYYY-MM-DDThh:mm:ssZ)

세션 시작 시각

end_time

String (YYYY-MM-DDThh:mm:ssZ)?

세션 종료 시각

state

String (OPEN,CLOSED,COMPLETE)

세션의 상태

complete_time

String (YYYY-MM-DDThh:mm:ssZ)?

최종 세션 분석 완료 시각 if state != COMPLETE 해당 값은 null

Metadata Object

FieldTypeDescription
birth_yearInt?출생 연도 (1900 년 부터 현재 연도)
birth_monthInt?출생 달 (1 ~ 12 월)
birth_dayInt?출생 일 (1 ~ 31 일, 월/윤년에 따라 실제 유효 범위 상이)
genderString (male, female, non_binary, other, prefer_not_to_say)?성별
heightFloat?키 (0 ~ 300 cm, 소수점 한자리까지 허용)
weightFloat?체중 (0 ~ 1000 kg, 소수점 한자리까지 허용)
{
  "detail": "success",
  "result": {
    "user_id": "<USER_ID>",
    "to_be_deleted": false,
    "last_session_info": {
      "session_id": "20230630224117",
      "inference_type": "MELSPECTROGRAM",
      "service": "NOSERVICE",
      "start_time": "2023-06-30T22:41:17",
      "end_time": "2023-07-01T05:36:12",
      "state": "COMPLETE",
      "complete_time": "2023-07-01T05:41:12"
    },
    "metadata": {
      "birth_year": 2001,
      "birth_month": 1,
      "birth_day": 1,
      "gender": "male",
      "height": 178.6,
      "weight": 62.1
  }
}

401 Unauthorized

  • x-user-id 헤더 값이 없거나 포맷이 맞지 않음
{
  "detail": "invalid user id"
}

404 Not Found

  • 사용자 없음
{
  "detail": "user not exist"
}