Unofficial NameMC API Documentation made by Faav.
Documentation for https://namemc.com and www.faav.tk/v1/namemc.
I created this API for people who need to use NameMC's database in a automated way.
This API scrapes the NameMC website in order to provide accurate responses. If the NameMC layout changes or goes offline, this API will provide inaccurate information or will not function at all. Please keep this in mind while using this API.
- NameMC Skin Hash API (documentation)
- NameMC Cape Hash API (documentation)
- NameMC Capes API (documentation)
- NameMC Cape Count API (documentation)
- NameMC Face Icon API (documentation)
- NameMC Connections API (documentation)
- NameMC Connections Count API (documentation)
- NameMC Rank API (documentation)
- NameMC Emoji API (documentation)
- NameMC Custom Font API (documentation)
- NameMC Favorite Servers API (documentation)
- NameMC Favorite Servers Count API (documentation)
- NameMC Friends API (documentation)
<html>
<head>
<script>
var getJSON = function(url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'json';
xhr.onload = function() {
var status = xhr.status;
if (status === 200) {
callback(null, xhr.response);
} else {
callback(status, xhr.response);
}
};
xhr.send();
};
getJSON('https://www.faav.tk/v1/namemc/capecount?username=Marc',
function(err, data) {
if (err !== null) {
document.getElementById('marc').innerHTML = err;
} else {
document.getElementById('marc').innerHTML = 'Marc has '+data.formatted+' capes.';
}
});
</script>
</head>
<body>
<p id="marc">Marc has 0 capes.</p>
</body>
</html>
<?php
$namemc_api = json_decode(file_get_contents("https://www.faav.tk/v1/namemc/capecount?username=Marc"), false);
$marcs_capes = $namemc_api -> formatted;
echo '<p>Marc has '.$marcs_capes." capes.</p>";
?>
public static void main(String[] args) {
final OkHttpClient okHttpClient = new OkHttpClient();
final Gson gson = new Gson();
final Request request = new Request.Builder()
.url("https://www.faav.tk/v1/namemc/capecount?username=Marc")
.get()
.build();
try (final Response response = okHttpClient.newCall(request).execute()) {
if (response.isSuccessful()) {
final JsonObject jsonObject = gson.fromJson(response.body().charStream(), JsonObject.class);
System.out.printf("Marc has %s capes", jsonObject.get("formatted").getAsString());
}
} catch (IOException e) {
e.printStackTrace();
}
}
Thank you JerreBor (Jero) for the Java usage example, and thank you 88 (lucky swede) for the documentation template.
This API is not affiliated nor indorsed by NameMC, Minecraft, Mojang, or Microsoft.