-
-
Notifications
You must be signed in to change notification settings - Fork 51
Paste site API
- Download
- Connect
- Authenticate
- List
- Upload
- Delete
- Update
- Browser Login
- App Login
- App Check
- App Token Request
- Error Messages
API url: https://paste.tom5454.com/
Full implenetation in Java: PasteClient in CPM
URL: raw/<paste_id>
URL: api/connect?name=<username>
Response: (JSON)
- id: Session id, required in future requests
- key: Minecraft Join Server key
Run minecraft's join server api.
This is the same authentication that Minecraft uses when you join a Minecraft server.
URL: https://sessionserver.mojang.com/session/minecraft/join
POST request required
Post body: (JSON object)
- accessToken: Minecraft account access token
- selectedProfile: Minecraft account uuid as string (without
-
characters) - serverId: server id calculated with
key
Calculating the serverId:
SHA-1 hash:
tom5454-paste
, <session id>
, and <key>
as ascii string
then toString the result as hex number.
Java example code:
byte[] mojKey = Base64.getDecoder().decode(key);//key string from api
//SHA-1 digest all of the data
byte[] mojangKey = digestData("tom5454-paste".getBytes(), session.getBytes(), mojKey);
String serverId = new BigInteger(mojangKey).toString(16);
Call Authenticate to finish setting up the session.
URL: api/session
HTTP headers:
- Session:
Response: (JSON)
Empty JSON on success
URL: api/list
HTTP headers:
- Session:
Auth required
Response: (JSON)
- files (Array of Objects)
(each object)- id: paste id
- name: Paste name
- time: upload time as string in ms UTC time
- maxSize
- maxFiles
URL: api/upload
HTTP headers:
- Session:
- Content-Length: Length of file
- File-Name: Paste name
Auth required
POST request required
Post body: paste content
Response: (JSON)
- id: new random paste id for the paste
URL: api/delete?file=<paste_id>
HTTP headers:
- Session:
Auth required
Response: (JSON)
Empty JSON on success
URL: api/update?file=<paste_id>
HTTP headers:
- Session:
- Content-Length: Length of file
Auth required
POST request required
Post body: paste content
Response: (JSON)
Empty JSON on success
URL: api/browser_login
HTTP headers:
- Session:
Auth required
Response: (JSON)
- id: browser login token valid for 5 minutes, usable with
/login.html?id=<id>
site
URL: api/app_login
HTTP headers:
- AppID:
Response: (JSON)
- id: application login token valid for 5 minutes, usable with
/auth.html?id=<id>
site
URL: api/app_check
HTTP headers:
- AppID:
- Session:
Response: (JSON)
- id: paste application token or
- empty JSON if not authorized yet
URL: api/app_token_req
HTTP headers:
- AppID:
- Session:
Response: (JSON)
Respose: (JSON)
- error: Human readable error message
- errorMessage: Translation key for error message
Customizable Player Models Wiki