[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}" -XGET \
  -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마지막 세션 정보

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

{
  "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"
    }
  }
}

401 Unauthorized

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

404 Not Found

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