Get a players name from their UUID
There isn't a way to print a user's UUID in-game. However - Your method works.
If you are using a white-list, you can view the whitelist.json file to get a mapping of UUIDs with their player names – Avaq
https://gaming.stackexchange.com/a/190188/75275
Whitelisting/opping/banning someone and then finding out their UUID from the ops.txt, banned.txt and whitelist.txt files work, but you may unexpectly give them/revoke their access to the server.
(ie. I banned you... Accidentally while trying to find out your UUID and then forgot to unban)
Alternatively, you can find out their UUID by querying the Minecraft web API.
wiki.vg/Mojang_API#UUID_-.3E_Profile_.2B_Skin.2FCape
Get a players name from their UUID – mid_kid
Because it uses HTTP and special inputs alongside its commands (querys) to the server, you cannot use a web browser. You'll have to use a program that allows custom HTTP commands, rather than your standard GET http://www.google.com
, or as otherwise known as "Google, load me your frontpage." or POST http://upload.[somesite].com/[Unique access key] [Insert file contents]
, which is uploading a file to a server... ie. Uploading pictures to StackExchange.
If you have Google Chrome, you can download this extension that allows you to post custom HTTP requests. Even non-generic ones.
https://chrome.google.com/webstore/detail/dhc-resthttp-api-client/aejoelaoggembcahagimdiliamlcdmfm
While you're doing it, ensure that you have clicked the "JSON" button at the bottom. This will tell the server that "This [text] is in json format, and not raw text."
In this example, an input of:
Content-Type: application/json
["aytimothy"]
using POST https://api.mojang.com/profiles/minecraft
gives a return of:
[{"id":"29c91bd0538b4fb6b212e2393faff119","name":"aytimothy"}]
meaning, user "aytimothy" (me), have a UUID of "29c91bd0538b4fb6b212e2393faff119".
UUIDs does not reveal a client's login. You can only log in/logout/etc. with the client token, access token or the account's username/password.
Hi. Thanks for your expansive answer! I'm using cURL to achieve a POST request using the following command:
curl -X POST -H 'Content-Type: application/json' https://api.mojang.com/profiles/minecraft -d '["Avaq"]'
. You might want to extend your answer further by adding that option. I'll still accept it though. :) – Avaq
Get a players name from their UUID
Note: I've never used cURL, so sorry if any of the commands do not work.
Just to point out: I accidentally did the method to find out the UUID from a username.
You can get a username from an UUID by going to: https://api.mojang.com/user/profiles/[UUID]/names
For example: Mine is https://api.mojang.com/user/profiles/29c91bd0538b4fb6b212e2393faff119/names
So pretty much, the command you're looking for is:
CURL https://api.mojang.com/user/profiles/[UUID]/names
For me:
CURL https://api.mojang.com/user/profiles/29c91bd0538b4fb6b212e2393faff119/names
But anyways - To send a POST request (that's if you want to turn a username into its UUID):
CURL -H "content-type: application/json" -D "["username"]" https://api.mojang.com/profiles/minecraft
I'm not sure if the middle "["username"]"
bit works because of the way cURL phrases the quotes that are inside another set of quotes.
If cURL does not allow for content to have extra quotes within it, there is no way you can do that with the command line.
Also, you should also be expecting for a code 200 (Request was successful, got it... And sending result now.) followed by a reply to your query.