MC-API / Issues

Public issue tracker for mc-api.net
https://mc-api.net
2 stars 0 forks source link

Errors retrieving UUIDs. #23

Closed remydimauro closed 8 years ago

remydimauro commented 8 years ago

Heyo! As of late, it seems that retrieving UUIDs sometimes returns 404 errors. It seems to be happening for people who have recently changed their name. My network literally runs off this API so a quick answer would be appreciated :)

njb-said commented 8 years ago

Hi, Could you give me an example code snippet so I can try to work out the cause of this. It is possible the names/uuids are being cached when you are requesting them. Thanks :smiley:

remydimauro commented 8 years ago

This is the code snippet that I use to retrieve UUID's

`URL url = new URL("http://eu.mc-api.net/v3/uuid/" + name); HttpURLConnection request = (HttpURLConnection) url.openConnection(); request.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"); request.connect();

        JsonParser jp = new JsonParser();
        JsonElement root = jp.parse(new InputStreamReader((InputStream) request.getContent()));
        JsonObject rootobj = root.getAsJsonObject();

        String uuid = rootobj.get("full_uuid").getAsString();`
njb-said commented 8 years ago

Sorry for the late reply, I have done a little thinking and it is most likely to be a caching issue. I think that the name you are requesting may have been changed but it is cached and therefore the server will output that. My only suggestion is try another server like us.mc-api.net, not ideal I know but give it a try and tell me how it goes :+1: