Skip to content

MyReflex API

Steven edited this page Jul 19, 2020 · 7 revisions

MyReflex is our web panel that allows you to manage your Reflex copy access — https://my.reflex.rip/

The MyReflex API is an interface to manage your whitelist and security settings programmatically.
Current documented version: 1.0.0. The version live may be newer.

Note
All request bodies have to be provided as JSON formatted string.
Important
Not all errors are listed with their example response. Some errorCodes may occur that you have never seen before. Watch out and don’t be scared.

General

GET /

Description

You want to know who you are talking to, right?

Request params

none

Query params

none

Request body

none

Example response

200:

{
    "name": "Reflex User API",
    "description": "Welcome, товарищ.",
    "version": "1.0.0"
}

Authentication

GET /auth

Description

Get a list of all sessions

Request params

none

Query params

optional

  • page (not <0, required if page_size specified) [int]

  • page_size (not <0, required if page specified) [int]

  • cookie (will remove apiKey from response) [bool]

Request body

none

Example response

200:

{
    "status": "success",
    "entries": [
        {
            "sessionID": "12345-0",
            "ipAddress": "1.2.3.4",
            "userAgent": "PostmanRuntime/7.26.1",
            "cookie": false,
            "expires": 1595007525394
        },
        {
            "sessionID": "12345-1",
            "ipAddress": "2.3.4.5",
            "userAgent": "PostmanRuntime/7.26.1",
            "cookie": true,
            "expires": 1595007589703
        }
    ],
    "page": 1,
    "pageSize": 2,
    "totalEntries": 3,
    "totalPages": 4
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

POST /auth

Description

Authenticate to the service

Request params

none

Query params

none

Request body
  • username (from SpigotMC.org, required if userID not set) [string]

  • userID (from SpigotMC.org, required if username not set) [int]

  • password (from API) [string]

  • cookie (optional, cookie with credentials will be returned, response won’t include apiKey) [bool]

Example response

200:

{
    "status": "success",
    "apiKey": "ABCDEFGHIJKLMNOPQRSTU123",
    "expires": 1595007525394,
    "sessionID": "12345-0",
    "cookie": false
}
Errors

400: Bad/Malformed request
401: Incorrect login data

{
    "status": "error",
    "errorCode": "CREDENTIALS_INVALID"
}

403: Already authenticated

{
    "status": "error",
    "errorCode": "ALREADY_AUTHENTICATED"
}

GET /auth/{id}

Description

Information of a specific session

Request params
  • id (me → current session or specific session id, e.g. 1337)

Query params

none

Request body

none

Example response

200:

{
    "status": "success",
    "username": "xXxiTzTheHardCorePlayer420xXx_69",
    "userID": 12345,
    "sessionID": "12345-0",
    "ipAddress": "1.2.3.4",
    "userAgent": "PostmanRuntime/7.26.1",
    "cookie": true,
    "expires": 1595009683109
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

404: Session not found

{
    "status": "error",
    "errorCode": "SESSION_NOT_FOUND"
}

DELETE /auth/{id}

Description

Invalidate a specific session

Request params
  • id (me → current session or specific session id, e.g. 1337) [string or int]

Query params

none

Request body

none

Example response

200:

{
    "status": "success",
    "information": "LOGGED_OUT"
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

404: Session not found

{
    "status": "error",
    "errorCode": "SESSION_NOT_FOUND"
}

POST /auth/password

Description

Change your password.
The passwords can’t be the same. After password change all sessions will be invalidated and you have to re-login.

Request params

none

Query params

none

Request body
  • oldPassword [string]

  • newPassword [string]

Example response

200:

{
    "status": "success",
    "information": "ALL_SESSIONS_INVALIDATED_RELOGIN_REQUIRED"
}
Errors

400: Bad/Malformed request
401: Invalid session/Invalid password
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

409: Weak or same password.

{
    "status": "error",
    "errorCode": "NEW_PASSWORD_IS_WEAK"
}

Histories

GET /history/reflex

Description

Get a list of all Reflex start-ups in the last 30 days

Request params

none

Query params

optional

  • page (not <0, required if page_size specified) [int]

  • page_size (not <0, required if page specified) [int]

Request body

none

Example response

200:

{
    "status": "success",
    "entries": [
        {
            "ipAddress": "1.2.3.4",
            "timestamp": 1595007521337
        },
        {
            "ipAddress": "2.3.4.5",
            "timestamp": 1595007581337
        }
    ],
    "page": 1,
    "pageSize": 2,
    "totalEntries": 3,
    "totalPages": 4
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

GET /history/api

Description

Get a list of all API logins in the last 30 days

Request params

none

Query params

optional

  • page (not <0, required if page_size specified) [int]

  • page_size (not <0, required if page specified) [int]

Request body

none

Example response

200:

{
    "status": "success",
    "entries": [
        {
            "ipAddress": "1.2.3.4",
            "timestamp": 1595007525394,
            "userAgent": "PostmanRuntime/7.26.1"
        },
        {
            "ipAddress": "2.3.4.5",
            "timestamp": 1595007589703,
            "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
        }
    ],
    "page": 1,
    "pageSize": 2,
    "totalEntries": 3,
    "totalPages": 4
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

Whitelist

GET /whitelist

Description

Get the status of the whitelist

Request params

none

Query params

none

Request body

none

Example response

200:

{
    "status": "success",
    "information": "ENABLED"
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

POST /whitelist

Description

Enable the whitelist

Request params

none

Query params

none

Request body

none

Example response

200:

{
    "status": "success",
    "information": "ENABLED"
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

409: Whitelist already enabled

{
    "status": "error",
    "errorCode": "ALREADY_ENABLED"
}

DELETE /whitelist

Description

Disable the whitelist

Request params

none

Query params

none

Request body

none

Example response

200:

{
    "status": "success",
    "information": "DISABLED"
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

403: Whitelist disabling is not allowed (contact us on Discord)

{
    "status": "error",
    "errorCode": "NOT_ALLOWED_TO_DISABLE_WHITELIST"
}

409: Whitelist already disabled

{
    "status": "error",
    "errorCode": "ALREADY_DISABLED"
}

GET /whitelist/ips

Description

Get a list of all IPs in whitelist

Request params

none

Query params

optional

  • page (not <0, required if page_size specified) [int]

  • page_size (not <0, required if page specified) [int]

Request body

none

Example response

200:

{
    "status": "success",
    "entries": [
        "42.42.42.42",
        "1.1.1.1"
    ],
    "page": 1,
    "pageSize": 2,
    "totalEntries": 3,
    "totalPages": 4
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

DELETE /whitelist/ips

Description

Delete all IP addresses from whitelist

Request params

none

Query params

none

Request body

none

Example response

200:

{
    "status": "success",
    "information": "DELETED"
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

PATCH /whitelist/ips

Description

Bulk add/remove IPs from whitelist

Request params

none

Query params

optional

  • page (not <0, required if page_size specified) [int]

  • page_size (not <0, required if page specified) [int]

Request body

optional

  • add (IP addresses to add, e.g. ["1.1.1.1"]) [array of string]

  • remove (IP addresses to remove, e.g. ["8.8.8.8", "4.4.4.4"]) [array of string]

Example response

200:

{
    "status": "success"
}
Errors

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

400: Bad/Malformed request or no data provided

{
    "status": "error",
    "errorCode": "NO_CHANGES_DETECTED"
}

POST /whitelist/ips/{ip}

Description

Add IP to whitelist

Request params
  • ip (to add, e.g. 1.1.1.1) [string]

Query params

none

Request body

none

Example response

200:

{
    "status": "success",
    "information": "ENABLED"
}
Errors

400: No valid IP address provided

{
    "status": "error",
    "errorCode": "NO_VALID_IP"
}

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

409: Already enabled

{
    "status": "error",
    "errorCode": "ALREADY_ENABLED"
}

DELETE /whitelist/ips/{ip}

Description

Delete IP from whitelist

Request params
  • ip (to remove, e.g. 1.1.1.1) [string]

Query params

none

Request body

none

Example response

200:

{
    "status": "success",
    "information": "DISABLED"
}
Errors

400: No valid IP address provided

{
    "status": "error",
    "errorCode": "NO_VALID_IP"
}

401: Invalid session
403: Session with cookie used without cookie send / session with API key used in cookie when cookie hasn’t been requested

{
    "status": "error",
    "errorCode": "SESSION_INVALID"
}

404: IP not found
409: Already disabled

{
    "status": "error",
    "errorCode": "ALREADY_DISABLED"
}