I’m trying to make some code in Javascript that allows me to execute and paste on a set list of items.
When I try to execute my code, I am left with error 401 (Authorization has been denied for this request.)
I have already tried looking for solutions from other sources, and have executed this while logged into roblox, and on the page.
The api site I am posting to, using fetch, is https://avatar.roblox.com/docs#!/Avatar/post_v1_avatar_set_wearing_assets
,
And this is the code that I have come up with.
let req = fetch("https://avatar.roblox.com/v1/avatar/set-wearing-assets", {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
'assetIds': [
6399352012,//just one hat
]
}),
}).then((response) => response.json())
.then((responseData) => {
console.log(responseData);
return responseData;
})
.catch(error => console.warn(error));