const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: {name: 'vendor'}})
};
fetch('http://{defaultHost}/api/v2/platform/roles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));