This is somewhat a continuation of this older thread.
I have managed to figure out that the following should generally work.
var request = new XMLHttpRequest();
request.open("POST", "https://community.fandom.com/wikia.php?controller=UserProfile&method=setDefaultAvatar&format=json");
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send("placeholder");Where placeholder is replaced with the properly encoded data. The required data is as follows.
token - some token retrieved some somewhere
userId - the ID of the user for which to change the avatar
avatarUrl - the URL to the avatar
The issue I am having is figuring out which URLs are considered valid. When using one of the stock images, the URL is as follows.
https://static.wikia.nocookie.net/1c6b3ae9-b3f6-4094-bf7e-e917a96fa68a/thumbnail/width/348/height/348However, when I try something like the following, an internal error occurs.
https://vignette.wikia.nocookie.net/messaging/images/c/cf/Avatar6.jpg/revision/latest?cb=20110817175751I have already done some testing and I am pretty sure the issue isn't static versus vignette. The issue also does not appear to be the /thumbnail portion of the URL nor the query string at the end of the image's URL. As such, the only thing I think it could be is the /messaging part versus the UUID.
Does anyone know if my conclusion is correct? If so, is there some way to get the UUID-based URL knowing the other URL?
Not as important but I am also curious if anyone knows how to get the token. From what I can tell, it isn't any of the tokens returned by api.php?action=query&meta=tokens.