Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Electroid/mojang-api
Bundle multiple Minecraft APIs into a single GET request.
https://github.com/Electroid/mojang-api
cloudflare-worker coffeescript minecraft mojang
Last synced: 14 days ago
JSON representation
Bundle multiple Minecraft APIs into a single GET request.
- Host: GitHub
- URL: https://github.com/Electroid/mojang-api
- Owner: Electroid
- License: mit
- Created: 2018-06-26T03:40:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-10T00:35:37.000Z (over 1 year ago)
- Last Synced: 2024-11-17T14:05:11.944Z (26 days ago)
- Topics: cloudflare-worker, coffeescript, minecraft, mojang
- Language: CoffeeScript
- Homepage: https://api.ashcon.app/mojang/v2/user/Notch
- Size: 644 KB
- Stars: 242
- Watchers: 8
- Forks: 17
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - Electroid/mojang-api - Bundle multiple Minecraft APIs into a single GET request. (CoffeeScript)
- awesome - Electroid/mojang-api - Bundle multiple Minecraft APIs into a single GET request. (CoffeeScript)
README
# mojang-api
Javascript microservice that bundles multiple Mojang APIs into a single GET request.### Purpose
Mojang, the developers of [Minecraft](https://en.wikipedia.org/wiki/Minecraft), provides [multiple APIs](http://wiki.vg/Mojang_API) for websites and servers to fetch identity information about users. Requests do not accept authentication tokens, however they are heavily rate limited and fragmented among several endpoints. The purpose of this project is to package several of the most commonly used APIs into a single GET request with no rate limiting and no need for client-side caching.
I have deployed this on my personal domain `ashcon.app` and am opening it up for the internet to use for free. It runs using [Cloudflare Workers](https://developers.cloudflare.com/workers/about/), which are Javascript functions that live in the closest datacenter to your request. The API is currently handling 1M+ requests per day with an average response time of 200ms and a < 0.0001% error rate.
### Single Request *(now)*
Username or UUID -> Everything
[https://api.ashcon.app/mojang/v2/user/[username|uuid]](https://api.ashcon.app/mojang/v2/user/Notch) `(click for example)`
```
{
"uuid": ,
"username": ,
"username_history": [
{
"username": ,
"changed_at":
}
],
"textures": {
"slim": ,
"custom": ,
"skin": {
"url": ,
"data":
},
"cape": {
"url": ,
"data":
},
"raw": {
"value": ,
"signature":
}
},
"legacy": ,
"demo": ,
"created_at":
}
```### Multiple Requests *(before)*
Username -> UUID
[https://api.mojang.com/users/profiles/minecraft/[username]](https://api.mojang.com/users/profiles/minecraft/ElectroidFilms)
```
{
"id": ,
"name":
}
```
UUID -> Username History
[https://api.mojang.com/user/profiles/[uuid]/names](https://api.mojang.com/user/profiles/dad8b95ccf6a44df982e8c8dd70201e0/names)
```
[
{
"name":
},
{
"name": ,
"changedToAt":
}
]
```
UUID -> Profile + Textures
[https://sessionserver.mojang.com/session/minecraft/profile/[uuid]](https://sessionserver.mojang.com/session/minecraft/profile/dad8b95ccf6a44df982e8c8dd70201e0)
```
{
"id": ,
"name": ,
"properties": [
{
"name": "textures",
"value": // Then decode the base64 string and make http requests to fetch the textures...
}
]
}
```### Build
```
wrangler build
wrangler preview
```