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으로 변경해서 반환 | 
1.3 Query parameter
| Field | Type | Required | Default | Description | 
|---|---|---|---|---|
| date_gte | String ( | X | Header의 timezone 기준으로 date_gte 보다 같거나 큰 세션들 반환 | |
| date_lte | String ( | X | Header의 timezone 기준으로 date_lte 보다 같거나 작은 세션들 반환 | |
| order_by | String ( | X | 
 | 
 | 
| offset | Int | X | 0 | 스킵할 세션 개수 | 
| limit | Int ( | 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 ( | 세션의 상태 | 
| session_start_time | String ( | 세션 시작 시각 | 
| session_end_time | String ( | 세션 종료 시각 | 
| last_received_seq_num | Int? | 마지막으로 업로드 받은 오디오 파일의 순서 번호 | 
| time_in_bed | Int ( | 침대에 있었던 시간 | 
2.2 400 Bad Request
- timezone이 잘못 들어온 경우
{
	"detail": "The invalid timezone is provided"
}Updated 5 months ago
