Skip to content

Latest commit

 

History

History
109 lines (77 loc) · 3.26 KB

HttpProtocolV1.md

File metadata and controls

109 lines (77 loc) · 3.26 KB

HTTP REST Protocol (version 1)
Sessions Microservice

Sessions microservice implements a HTTP compatible API, that can be accessed on configured port. All input and output data is serialized in JSON format. Errors are returned in standard format.

Data types

SessionV1 class

Represents an open user session

Properties:

  • id: string - unique session id
  • user_id: string - unique user id
  • user_name: string - Full user name just for information
  • active: boolean - True if session is still active
  • open_time: Date - date and time when session was opened
  • request_time: Date - date and time when last request was processed
  • close_time: Date - date and time when session was closed
  • address: string - client address
  • client: string - client application name
  • user: Object - information about user
  • data: Object - session data

Operations

Method: 'POST', route '/sessions/get_sessions'

Retrieves all opened user sessions or a specified session.

Request body:

  • filter: object - filter parameters
    • user_id: string - (optional) unique user id
    • active: boolean - (optional) active connections
    • from_time: Date - (optional) start of the time range
    • to_time: Date - (optional) end of the time range
  • paging: object - paging parameters
    • skip: int - (optional) start of page (default: 0)
    • take: int - (optional) page length (default: 100)
    • total: boolean - (optional) include total counter into paged result (default: false)

Response body: DataPage object or error

Method: 'POST', route '/sessions/get_session_by_id'

Load opened user session by user id and session id.

Request body:

  • session_id: string - unique session id
  • data: Object - session data

Response body: Occurred error or null for success

Method: 'POST', route '/sessions/open_session'

Opens a new user session and stores user information in it.

Request body:

  • user_id: string - unique user id
  • user_name: string - full user name
  • address: string - client address
  • client: string - client application name
  • user: Object - user data
  • data: Object - session data

Response body: Created SessionV1 or error

Method: 'POST', route '/sessions/store_session_data'

Stores session data

Request body:

  • session_id: string - unique session id
  • data: Object - session data

Response body: Updated SessionV1 or error

Method: 'POST', route '/sessions/close_session'

Closes user session either by its id

Request body:

  • session_id: (optional) string - unique session id

Response body: Closed SessionV1 or error

Method: 'POST', route '/sessions/delete_session_by_id'

Deletes session by specified session ids.

Request body:

  • session_id: (optional) string - unique session id

Response body: Deleted SessionV1 or error