Sessions

Get sessions list

getSessions Operator user required Frontend can be closed, restricted or open

Get list of sessions created

Response
[
    {
        "active": true,
        "name": "Jonetsu IV Day 1",
        "seid": "..."
        "started_at": "Sat 13 Oct 2019 09:30:00",
        "private": true, // Private sessions won't be sent to KM Server
        "ended_at": "Sat 13 Oct 2019 18:00:00"
    },
    ...
]
Response
{
    code: 500,
    message: {
        code: 'SESSION_LIST_ERROR'
    }
}

Create session

createSession Operator user required Frontend can be closed, restricted or open

Add a new session to the list

Request
{
    name: 'Jonetsu IV Day 2', // This one is mandatory
    started_at: '2019-04-05 09:30',
    ended_at: null,
    activate: true, // Make this the active session immediately
    private: false, // Session is not private and will be sent to KM Server for analysis
}
Response
{
    code: 200,
    message: {
        code: 'SESSION_CREATED'
    }
}
Response
{
    code: 500,
    message: {
        code: 'SESSION_CREATION_ERROR'
    }
}

Merge sessions

mergeSessions Operator user required Frontend can be closed, restricted or open

Merge two sessions into a new one. Data from both sessions will be aggregated into a new one. The two sessions are then removed.

Request
{
    seid1: <uuid>,
    seid2: <uuid>
}
Response
{
    code: 200,
    message: {
        code: 'SESSIONS_MERGED'
        data: {
            session: { <new session object> }
        }
    }
},
Response
{
    code: 500,
    message: {
        code: 'SESSION_MERGE_ERROR'
    }
}

Edit session

editSession Operator user required Frontend can be closed, restricted or open

Edit session

See Get Sessions List.

Request
{
    <session object>
}
Response
{
    code: 200,
    message: {
        code: 'SESSION_EDITED'
    }
}
Response
{
    code: 500,
    message: {
        code: 'SESSION_EDIT_ERROR'
    }
}
Response
{
    code: 404,
    message: {
        code: 'ERROR_CODES.SESSION_NOT_FOUND'
    }
}

Sent when a session ends before it starts, or vice versa.

Response
{
    code: 409,
    message: {
        code: 'ERROR_CODES.SESSION_END_BEFORE_START_ERROR'
    }
}

Activate session

activateSession Operator user required Frontend can be closed, restricted or open

Session will be made active : all played and requested songs will be linked to that session from now on.

Request
{
  seid: <uuid>
}
Response
{
  code: 200,
  message: {
      code: 'SESSION_ACTIVATED'
  }
}
Response
{
    code: 500,
    message: {
        code: 'REPO_EDIT_ERROR'
    }
}
Response
{
    code: 400   
}

Remove session

deleteSession Operator user required Frontend can be closed, restricted or open

Delete session from database

Request
{
  seid: <uuid>
}
Response
{
  code: 200,
  message: {
      code: 'SESSION_DELETED'
  }
}
Response
{
    code: 500,
    message: {
        code: 'SESSION_DELETE_ERROR'
    }
}
Response
{
    code: 400,    
}

You cannot remove active sessions

Response
{
    code: 403,
    message: {
        code: 'SESSION_DELETE_ERROR'
    }
}
Response
{
    code: 404,
    message: {
        code: 'SESSION_DELETE_ERROR'
    }
}

Export session

exportSession Operator user required Frontend can be closed, restricted or open

Export session data (played and requested songs, as well as top requested and number of played songs) in CSV format.

Request
{
  seid: <uuid>
}

Response contains names of files for each report. You can give access to them through http://localhost:<port>/sessionExports/<filename>

Response
[
    requested: "My Session.2021-04-06.requested.csv",
    played: "My Session.2021-04-06.played.csv",
    playedCount: "My Session.2021-04-06.playedCount.csv",
    requestedCount: "My Session.2021-04-06.requestedCount.csv"
]
Response
{
    code: 500,
    message: {
        code: 'SESSION_EXPORT_ERROR'
    }
}