[POST] Reanalyze Session

특정 세션의 수면 분석을 다시 실행합니다. start_time/end_time으로 분석 구간을 지정하면 해당 구간을 기준으로 다시 분석합니다.

분석 구간이 지정된 세션의 분석 구간 정보는 Get Session (v4)analysis 객체로 확인할 수 있습니다.

Request

URL

POST https://api.asleep.ai/data/v1/sessions/{session_id}/reanalyze

Header

FieldTypeRequiredDescription
x-api-keyStringOAPI Key
x-user-idStringO발급받은 user id

Path parameter

FieldTypeRequiredDescription
session_idStringO재분석을 요청하고자 하는 세션의 id

Body

  • start_time, end_time은 모두 UTC로 입력해야 합니다.
  • start_timeend_time보다 빠른 시각이어야 합니다.
FieldTypeRequiredDescription
start_timeString (YYYY-MM-DDThh:mm:ss+00:00)?X분석 구간 시작 시각 (UTC 필수)
end_timeString (YYYY-MM-DDThh:mm:ss+00:00)?X분석 구간 종료 시각 (UTC 필수)

Example

curl "https://api.asleep.ai/data/v1/sessions/{session_id}/reanalyze" -XPOST \
  -H "x-api-key: <YOUR_API_KEY>" \
  -H "x-user-id: <USER_ID>" \
  -H "Content-Type: application/json" \
  -d '{
    "start_time": "2025-01-15T03:00:00+00:00",
    "end_time": "2025-01-15T07:00:00+00:00"
}'

Response

200 OK

  • 재분석 성공
{
	"detail": "reanalyze success"
}
  • 이미 동일한 조건으로 분석되어 있어 재분석이 수행되지 않은 경우
{
	"detail": "already analyzed"
}

400 Bad Request

  • session_id가 잘못된 형식인 경우
{
	"detail": "The format of sleep session id 20230608020315_hz82 is not valid"
}
  • start_time 또는 end_time이 UTC가 아닌 경우
{
	"detail": "analysis times must be UTC"
}
  • start_timeend_time보다 늦거나 같은 경우
{
	"detail": "start_time must be before end_time"
}
  • 분석 구간이 세션의 수면 데이터 범위를 벗어난 경우
{
	"detail": "analysis range exceeds the available sleep data"
}

401 Unauthorized

  • 인증 정보가 없거나 유효하지 않은 경우
{
	"detail": "Unauthorized"
}

403 Forbidden

  • 접근 권한이 없는 고객이 요청한 경우
{
	"detail": "An inaccessible customer has made a request"
}

404 Not Found

  • session_id에 해당되는 세션을 찾지 못한 경우
{
	"detail": "Unable to find the sleep session of id {session_id}"
}
  • 세션의 수면 분석 정보를 찾지 못한 경우
{
	"detail": "Unable to find the sleep analysis of the sleep session {session_id}"
}

409 Conflict

  • 해당 세션의 재분석이 이미 진행 중인 경우
{
	"detail": "The reanalysis of the sleep session {session_id} is in progress"
}

410 Gone

  • 세션의 분석 결과가 더 이상 존재하지 않는 경우
{
	"detail": "Unable to find the analysis result of the sleep session {session_id}"
}

422 Unprocessable Entity

  • 세션이 COMPLETE 상태가 아닌 경우
{
	"detail": "The sleep session {session_id} is not complete"
}

Did this page help you?