본문으로 건너뛰기
Reincubate

Sessions

게시일: 2019년 6월 27일· 업데이트: 2019년 10월 14일

Cover image for: Sessions

A session object represents access to a specific source.

Sessions are always created with a pending state, until the API is able to verify access with the target source's service.

If the target source's service revokes access, the session will transition into an expired state.

Session are not client updatable.

Attributes

nametypedescription
idstringResource identifier.
resourcestring, always sessionResource type identifier.
organisationorganisation IDThe organisation the session is associated with.
keykey IDThe key associated with this resource.
useruser IDThe user the session is associated with.
sourcenested sourceThe source instance the session is associated with.
statestringOne of: pending, active, failed, expired.
errorstringA code referring to the reason the session expired.
date_createddatetimeWhen the resource was created.
date_expireddatetimeWhen the resource expired.

States

pending : The session is still being initialised.

active : The session is ready to be used to submit tasks.

failed : Session initialisation failed.

expired : The session has been invalidated.

Errors

A session can have two types of errors: initialisation errors and expiry errors.

Session initialisation errors typically occur due to a bad username or password, the need for 2FA authentication, or the service declining access to the source for some other reason. These errors will have the init_failed error type.

Most sessions will eventually expire. More session lifetime details can be found in the service specific docs. However, there are various triggers for session expiry:

service : The third-party service has invalidated the session. This is typically due to session timeouts within the third-party service (i.e. a session can only last 24 hours). However, it can also be caused by the owner of the source changing their credentials, as this often invalidates existing session, or it can be triggered by a security feature within the service, such as an intruder detection system.

api : The API periodically invalidates inactive sessions.

organisation : The organisation has invalidated the session, possibly on behalf of the end-user.

admin : An API administrator has invalidated the session.

Create POST /sessions

Parameters

nametypedescription
sourcerequiredThe source this session will be associated to. The contents should follow the source creation schema.
payloadrequiredThe session initialisation payload. The required contents depend on the service the source belongs to.

Using cURL

curl https://ricloud-api.reincubate.com/sessions \
  -X POST \
  -H 'Authorization: Token <your key_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "source": {
      "user": 1,
      "type": "icloud.account",
      "identifier": "john.appleseed@reincubate.com"
    },
    "payload": {
      "password": "1234"
    }
}'

Using ricloud-py

import ricloud

source = {
  'user': 1,
  'type': 'icloud.account',
  'identifier': 'john.appleseed@reincubate.com',
}

payload = {
  'password': '1234',
}

session = ricloud.Session.create(source=source, payload=payload)

Retrieve GET /sessions/{session ID}

Using cURL

curl https://ricloud-api.reincubate.com/sessions/<session ID> \
  -H 'Authorization: Token <your key_token>'

Using ricloud-py

import ricloud

session = ricloud.Session.retrieve(<session ID>)

List

GET /sessions

nametypedescription
keykey ID filterFilter by a key ID.
useruser ID filterFilter by a user ID.
sourcesource ID filterFilter by a source ID.
statestring filterFilter by the session state.
date_createddatetime filterFilter by when the session was created.
date_expireddatetime filterFilter by when the session was expired.

Using cURL

curl https://ricloud-api.reincubate.com/sessions \
  -H 'Authorization: Token <your key_token>'

Using ricloud-py

import ricloud

sessions = ricloud.Session.list()

Delete DELETE /sessions/{session ID}

This interaction expires the session and deletes any cached data associated with it on the API. The actual session resource instance is persisted for the record.

Using cURL

curl https://ricloud-api.reincubate.com/sessions/<session ID> \
  -X DELETE \
  -H 'Authorization: Token <your key_token>'

Using ricloud-py

import ricloud

session = ricloud.Session.delete_with_id(<session ID>)

# OR

session = ricloud.Session.retrieve(<session ID>)

session.delete()

관련 문서

도움이 필요하신가요?

모든 문의에 영업일 기준 1일 이내에 답변드리도록 노력하고 있습니다.

support@reincubate.com
King's Award for Enterprise 로고

King's Award for Enterprise: Reincubate는 영국 최고의 공식 비즈니스 영예를 네 차례 수상했으며, 가장 최근에는 지난 3년간의 뛰어난 성장을 인정받았습니다.

사용자 및 파트너와의 관계는 우리의 가치와 우리가 만드는 제품의 핵심입니다. 리뷰을(를) 통해 그들의 이야기를 들어보세요.

Centre for Assessment의 ISO 27001 인증, UKAS 공인

© 2008-2026 Reincubate Ltd. 모든 권리 보유. 잉글랜드 및 웨일스 등록 번호 5189175, VAT 번호 GB151788978. Camo®, Streamlight® 및 Reincubate®는 등록 상표입니다. 특허 출원 중.

도움말