Roles
Get all roles
fetch('https://fakegundamwikiapi.onrender.com/api/roles', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('Error:', err));
[
{
"roleId": 1,
"roleName": "Administrator",
"isActive": true,
"created": "0001-01-01T00:00:00",
"createdBy": null,
"lastModified": "0001-01-01T00:00:00",
"lastModifiedBy": null
}
]
Get a single role
fetch('https://fakegundamwikiapi.onrender.com/api/roles/1', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('Error:', err));
{
"roleId": 1,
"roleName": "Administrator",
"isActive": true,
"created": "0001-01-01T00:00:00",
"createdBy": null,
"lastModified": "0001-01-01T00:00:00",
"lastModifiedBy": null
}
Create a new role
fetch('https://fakegundamwikiapi.onrender.com/api/roles', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'roleName': 'User'
})
})
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('Error:', err));
{
"roleId": 1,
"roleName": "User",
"isActive": true,
"created": "0001-01-01T00:00:00",
"createdBy": null,
"lastModified": "0001-01-01T00:00:00",
"lastModifiedBy": null
}
Update a role
fetch('https://fakegundamwikiapi.onrender.com/api/roles', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'roleId': 1
'roleName': 'User'
})
})
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('Error:', err));
{
"roleId": 1,
"roleName": "Administrator",
"isActive": true,
"created": "0001-01-01T00:00:00",
"createdBy": null,
"lastModified": "0001-01-01T00:00:00",
"lastModifiedBy": null
}
Active/Inactive a role
fetch('https://fakegundamwikiapi.onrender.com/api/roles/1', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
}
});