GithubHelp home page GithubHelp logo

api's Introduction

API (Ktor implementation)

Warning: this page is outdated

Server

Rate limit is 120 requests per minute.

Routes

{
  "routes": {
    "GET": [
      "/",
      "/counts",
      "/players/{uuid}",
      "/players/by-name/{name}",
      "/servers/life/auctions",
      "/servers/life/auctions/{id}",
      "/servers/life/spawners",
      "/players/{uuid}/punishments",
      "/punishments/{id}"
    ]
  }
}

Other routes and parameters

  • /servers/life/auctions?includeExpired=true - Get all auctions (includeExpired defaults to false)
  • /servers/life/spawners?child_server=lifepve1 - Get spawners on a specific child server (child_server defaults to all servers)

Implemented features

  • Add ?pretty at the end of the URL to get pretty JSON instead of minified JSON.
  • #1
  • #2
  • #3

Authenticating

Use the header Authorization: Bearer <token> to authenticate.

api's People

Contributors

acrylic-style avatar

Stargazers

Tetsuya Yamamoto avatar  avatar  avatar Kisaragi avatar huda0209 avatar

Watchers

James Cloos avatar  avatar Kisaragi avatar

api's Issues

WebSocket /interchat/stream?server=string

Client → Server

Authentication

{
  "type": "auth",
  "key": "<api key>"
}

Send message

{
  "type": "message",
  "message": "some message"
}

Select guild

{
  "type": "select",
  "guildId": 0
}

Switch server

{
  "type": "switch_server",
  "server": "azisaba.net"
}

Invite a player to the selected guild

{
  "type": "invite",
  "player": "name_not_uuid"
}

Accept or reject an invite

{
  "type": "respond_invite",
  "guildName": "guildname",
  "accept": false
}

Change the nickname of the selected guild

{
  "type": "nick",
  "nickname": "null to reset; any string to set the nickname"
}

Server → Client

Component

{
  "type": "component",
  "message": { "Minecraft component": "serialized with gson" }
}

Error message

{
  "type": "error_message",
  "message": "something went wrong"
}

Message

{
  "type": "message",
  "message": "aiueo"
}

GET /counts

GET /counts

200

{
  "total_players": 154, // "playerCount" から変更
  "games": {
    "life": {
      "players": 100
    },
    "lgw": {
      "players": 30
    },
    "diverse": {
      "players": 20
    },
    "jg": {
      "players": 4,
      "modes": {
        "sclat": 4,
        "jg": 0,
        //つづく...
      }
    },
    //つづく...
  }
}

GET /players/{uuid}

GET /players/1865ab8c-700b-478b-9b52-a8c58739df1a

would return 200 OK:

{
  "uuid": "1865ab8c-700b-478b-9b52-a8c58739df1a",
  "name": "KotlinLove", // username stored in database, not mojang
  "groups": [
    // sorted by weight (first element is their highest group)
    // some non-public groups (such as switchdeveloper and punishment related groups) may be excluded from this list
    // Sara (such as 100yen) is also included in this list, but groups of lower prices may or may not be missing. Highest sara is always included.
    "developer"
  ],
  "servers": {
    "life": {
      "admin": false,
      "moderator": false, // moderator and builder can be true at same time
      "builder": false,
      "rank": 7, // number of > 0
      // these balance values might be negative in rare cases
      "balance": 16256025.26, // result is equal to raw_balance + raw_offline_balance
      "raw_balance": 16256025.26,
      "raw_offline_balance": 0.0, // the balance which is still yet to be applied
      "total_play_time": 91219 // in minutes, same as tsl.total_play_time
    },
    "tsl": {
      "admin": false,
      "moderator": false,
      "builder": false,
      "total_play_time": 91219 // in minutes, same as life.total_play_time
    },
    "lgw": {
      "admin": false,
      "moderator": false,
      "builder": false,
      "vip": false
    },
    "despawn": {
      "admin": false,
      "moderator": false,
      "builder": false
    },
    "diverse": {
      "admin": false,
      "moderator": false,
      "builder": false
      // exp, money, veteranpoint, title might be added in the future
    },
    "vanilife": {
      "admin": false,
      "moderator": false,
      "builder": false
    }
  }
}

GET /players/bbd2e5c9-a232-3cc3-96b3-eba47c24f841

would return 400 Bad Request:

{
  "error": "cannot get player from offline (version 3) UUID"
}

Note: version 0 (used for accounts of Bedrock Edition) UUIDs should be allowed.

GET /punishments/{id}

GET /punishments/4845

The request will return 200 OK if:

  • API key holder (player) has sufficient punishment-related permissions
  • ???
{
  "id": 4845,
  "type": "CAUTION", // possible values are defined here: https://github.com/AzisabaNetwork/SpicyAzisaBan/blob/d90cef8ab2d216307b197403c5f58b5eae1d3cbb/common/src/main/kotlin/net/azisaba/spicyAzisaBan/punishment/PunishmentType.kt#L14-L25
  "target": {
    "uuid": "58becc44-c5b7-420f-8800-15ba88820973",
    "name": "ledlaggazi" // at the time of punishment - 処罰が執行された地点の名前
  },
  "actor": {
    "uuid": "1865ab8c-700b-478b-9b52-a8c58739df1a",
    "name": "KotlinLove" // at the time of the request - リクエストが送信された地点の名前
  },
  "reason": "多数のプレイヤーをサーバーに強制的に転送させてプレイヤーを混乱させた罪",
  "proofs": {
    "id": 146,
    "text": "https://messageviewer.azisaba.net/attachments/951067298964340736/unknown.png",
    "public": false
  },
  "start": 1657699502631, // the time which the punishment was issued - 処罰が執行された時間
  "end": -1, // the time which the punishment becomes no longer effective (-1 means permanent) - 処罰が期限切れになる時間(-1は永久)
  "server": "global", // server where the punishment is effective (global is a unique token which means the punishment is effective globally, regardless of the server) - 処罰が有効なサーバー (globalは処罰が全サーバーで有効なことを示す)
  "active": true, // true if punishment is effective at the time of the request. false if the punishment has expired, unpunished, or been removed from the table for any reason. - 処罰がリクエストの地点で有効な場合はtrue。処罰が期限切れ、解除、もしくは何らかの理由でテーブルから削除された場合はfalse。
  "extra": "SEEN", // SEEN means that the target has viewed the punishment (SEEN is used only if the type is CAUTION or WARNING, otherwise it will be empty) - targetが処罰を見たらSEENが記録される。SEENはtypeがCAUTIONかWARNINGの場合のみ使用され、それ以外の場合は空っぽになる。
  "unpunish": { // present (non-null) if the unpunish record is present in the table, so this property may be present even if unpunished is `false`, and this property might be absent even if unpunished is `true`. - unpunishの記録がテーブルに存在する場合はnull以外のオブジェクトが返される。unpunishedがtrueでもこれがnullの場合もあるし、unpunishedがfalseでもこれがnullではない場合もある。
    "id": 666,
    "actor": {
      "uuid": "1865ab8c-700b-478b-9b52-a8c58739df1a",
      "name": "KotlinLove"
    },
    "reason": "※実際には解除されてません",
    "timestamp": 666
  },
  "unpunished": true // true if punishment is removed from the table (this does not necessarily mean "unpunish" is present) - テーブルから処罰の記録が削除されている場合はtrueになる。
}

404 Not Found if:

  • Punishment does not exist

403 Forbidden if:

  • the player does not have sufficient permissions

401 Unauthorized if:

  • Authorization header is absent, or an API key is invalid.

GET /interchat/guilds/list

GET /interchat/guilds/list

Responses

200

[
  {
    "id": 112,
    "name": "aaaaaa",
    "format": "&5[&daaaaaa&7@&9%server&5] &r%prefix%username-nですわ~%suffix&d --> &f%msg",
    "capacity": 100,
    "deleted": false,
    "open": false
  }
]

GET /interchat/userdata

GET /interchat/userdata?uuid=string&server=string

Responses

200

server=hypixel.net

Note: Results from Hypixel API should be cached for up to 7 days, and the suffix is always empty

{
  "prefix": {
    "hypixel.net": "§b[MVP§9+§b] "
  },
  "suffix": {}
}

Other

{
  "prefix": {
    "life": "&8[&cAdmin&b*&8] &c",
    "global": "&8[&7Member&8] &7"
  },
  "suffix": {
    "global": "&d❤"
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.