Is it possible to get the currently logged in user with the REST API? Below is me kinda guessing based on the limited information i could find on it.
function queryShotgun() {
var headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json'
};
$.ajax({
url: 'https://[SiteURL].shotgunstudio.com/api/v1/auth/access_token',
method: 'post',
headers: headers,
data: {
grant_type: 'client_credentials',
client_id: 'queryToken',
client_secret: '(CodeGoesHere'
},
success: function (data) {
$('#accessOutput').html(data.access_token);
var headers = {
'Content-Type': 'application/json;odata=verbose',
'Authorization': `Bearer ${data.access_token}`
};
$.ajax({
url: 'https://[SiteURL].shotgunstudio.com/api/web/currentuser',
method: 'post',
headers: headers,
data: `${JSON.stringify(data)}`,
success: function (data) {
console.log(JSON.stringify(data));
$('#queryOutput').val(JSON.stringify(data, null, 3));
},
error: function (data) {
console.log(data)
$('#queryOutput').val(JSON.stringify(data, null, 3));
},
})
}
})
}
window.onload = function(){
queryShotgun();
};