Dashboard Sign InKR
These docs are for v1.0. Click to read the latest docs for v3.0.

List Multiple Sessions

특정 사용자의 수면 세션 목록을 요청합니다.

1. Request

1.1 URL

GET https://api.asleep.ai/data/v1/sessions

1.2 Header

FieldTypeRequiredDefaultDescription
x-api-keyStringO-API Key
x-user-idStringO-발급받은 user id
timezoneStringXUTC분석 결과의 시간대를 해당 timezone으로 변경해서 반환
예. UTC, Asia/Seoul

1.3 Query parameter

FieldTypeRequiredDefaultDescription
date_gteString (YYYY-MM-DD)X-Header의 timezone 기준으로 date_gte 보다 같거나 큰 세션들 반환
date_lteString (YYYY-MM-DD)X-Header의 timezone 기준으로 date_lte 보다 같거나 작은 세션들 반환
order_byString (ASCor DESC)XDESCDESC: 내림차순 정렬
ASC: 오름차순 정렬
offsetIntX0스킵할 세션 개수
limitInt (0~20 범위의 정수)X20받고 싶은 세션 개수

Example

curl "https://api.asleep.ai/data/v1/sessions?date_gte=2022-01-01&offset=10&limit=10&order_by=ASC" -XGET \
  -H "x-api-key: <YOUR_API_KEY>" \
  -H "x-user-id: <USER_ID>"

2. Response

2.1 200 OK

  • 세션 목록 조회 성공

2.1.1 Body (result field)

FieldTypeDescription
timezoneString타임존
sleep_session_listList of Sleep Session Objects세션 데이터 목록

2.1.2 Sleep Session Object

if state == OPEN: session_end_time은 null

FieldTypeDescription
session_idStringsession id
stateString (OPEN,CLOSED,COMPLETE)세션의 상태
OPEN: 진행 중인 세션으로, 오디오 업로드가 가능한 상태
CLOSED: 세션 종료 요청이 보내져 종료된 세션. 오디오 파일 업로드 불가능. 업로드된 수면 오디오에 대한 분석이 계속 진행중인 상태
COMPLETE: 세션 종료 후 모든 수면 분석이 완료된 상태
session_start_timeString (YYYY-MM-DDThh:mm:ss+-hh:mm)세션 시작 시각
예) 2022-08-01T01:31:17+09:00 (요청 타임존이 Asia/Seoul 일 경우)
session_end_timeString (YYYY-MM-DDThh:mm:ss+-hh:mm)?세션 종료 시각
예) 2022-08-01T01:31:17+09:00 (요청 타임존이 Asia/Seoul 일 경우)
last_received_seq_numInt?마지막으로 업로드 받은 오디오 파일의 순서 번호
time_in_bedInt (seconds)?침대에 있었던 시간

2.2 400 Bad Request

  • timezone 이 잘못 들어온 경우
{
	"detail": "The invalid timezone is provided"
}