List Multiple Sessions
특정 사용자의 수면 세션 목록을 요청합니다.
1. Request
1.1 URL
GET https://api.asleep.ai/data/v1/sessions
1.2 Header
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| x-api-key | String | O | API Key | |
| x-user-id | String | O | 발급받은 user id | |
| timezone | String | X | UTC | 분석 결과의 시간대를 해당 timezone으로 변경해서 반환 예. UTC, Asia/Seoul |
1.3 Query parameter
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| date_gte | String (YYYY-MM-DD) | X | Header의 timezone 기준으로 date_gte 보다 같거나 큰 세션들 반환 | |
| date_lte | String (YYYY-MM-DD) | X | Header의 timezone 기준으로 date_lte 보다 같거나 작은 세션들 반환 | |
| order_by | String (ASCor DESC) | X | DESC | DESC: 내림차순 정렬ASC: 오름차순 정렬 |
| offset | Int | X | 0 | 스킵할 세션 개수 |
| limit | Int (0~20 범위의 정수) | X | 20 | 받고 싶은 세션 개수 |
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)
| Field | Type | Description |
|---|---|---|
| timezone | String | 타임존 |
| sleep_session_list | List of Sleep Session Objects | 세션 데이터 목록 |
2.1.2 Sleep Session Object
if state == OPEN: session_end_time은 null
| Field | Type | Description |
|---|---|---|
| session_id | String | session id |
| state | String (OPEN,CLOSED,COMPLETE) | 세션의 상태OPEN: 진행 중인 세션으로, 오디오 업로드가 가능한 상태CLOSED: 세션 종료 요청이 보내져 종료된 세션. 오디오 파일 업로드 불가능. 업로드된 수면 오디오에 대한 분석이 계속 진행중인 상태COMPLETE: 세션 종료 후 모든 수면 분석이 완료된 상태 |
| session_start_time | String (YYYY-MM-DDThh:mm:ss+-hh:mm) | 세션 시작 시각 예) 2022-08-01T01:31:17+09:00 (요청 타임존이 Asia/Seoul 일 경우) |
| session_end_time | String (YYYY-MM-DDThh:mm:ss+-hh:mm)? | 세션 종료 시각 예) 2022-08-01T01:31:17+09:00 (요청 타임존이 Asia/Seoul 일 경우) |
| last_received_seq_num | Int? | 마지막으로 업로드 받은 오디오 파일의 순서 번호 |
| time_in_bed | Int (seconds)? | 침대에 있었던 시간 |
2.2 400 Bad Request
timezone이 잘못 들어온 경우
{
"detail": "The invalid timezone is provided"
}Updated over 1 year ago
Did this page help you?
