Skip to content

Endpoints

Matthew Messinger edited this page Oct 8, 2020 · 3 revisions

The server takes some inspiration from Mojang's server API. Here is a list of the current endpoints on the server.

The current API spec can be found here. https://skins.minelittlepony-mod.com/api/v1/

Unless otherwise specified, the response type for each endpoint is JSON.

Fetching skins

Endpoint: GET /api/v1/user/[uuid]
Parameters: None

Response

Field Type Description
timestamp long Timestamp when the response was generated
profileId String The uuid (without dashes) of the user
profileName String The name of the user
textures Texture Map Contains all the textures by type. e.g. SKIN, ELYTRA, CAPE
Texture.url String The URL of the texture
Texture.metadata String Map Map containing all of the texture's metadata. ex. "model": "slim"

See also: https://wiki.vg/Mojang_API#UUID_-.3E_Profile_.2B_Skin.2FCape

Authorizing for skin uploads

Any uploads needs to be authorized as a premium Mojang account. To do this, call the following endpoints. A current Mojang access token will be required. Don't worry, your sign-in name, password, nor access token are not sent to anyone but Mojang.

Auth Handshake

Endpoint: POST /api/v1/auth/handshake

Form Data

Field Type Description
name String Your Minecraft username

Response

Field Type Description
offline boolean True if authorization is not needed
serverId String A random string used for authorization
verifyToken int A random generated long to verify the authorization transaction

Using the retrieved information, make a request to Mojang's session server. You will need an access token.

If you are using AuthLib, it has a method for this request.

sessionService.joinServer(profile, token, serverId);

See Authentication for more details.

Auth Response

Endpoint: POST /api/v1/auth/response

Form Data:

Field Type Description
name String Your minecraft username
verifyToken int The token you recieved during the handshake endpoint

Response:

Field Type Description
accessToken String The token you should use for any skin change requests.
userId String The UUID of the user fetched from Mojang.

Uploading Skins

These endpoints require an Authorization header containing the access token retrieved at the end of the authorization steps. Failure to provide one will result in an 403 Forbidden status code.

Change Skin

Endpoint: POST /api/v1/user/[uuid]/[type]

Form Data:

Field Type Description
file URL The public URL to to the image to use as a skin.
[meta key] String The arbitrary metadata to apply to the texture upload.

Response:

Field Type Description
message String The message detailing what happened. If the upload failed, this will be a short description of the error.

Upload Skin

Endpoint: PUT /api/v1/user/[uuid]/[type]

Form Data:

Field Type Description
file File Multipart file upload of the skin
[meta key] String The arbitrary metadata to apply to the texture upload.

Response:

Field Type Description
message String The message detailing what happened. If the upload failed, this will be a short description of the error.

Clear Skin

Endpoint: DELETE /api/v1/user/[uuid]/[type]

Form Data: None

Response:

Field Type Description
message String The message detailing what happened. If the upload failed, this will be a short description of the error.