Reputation: 33
I need to find the user who is logged into the current session. I tried the following but does not work: Can anyone help me? Thanks in advance!
$.get(CurrentServerAddress + '/service/v4/rest.php', {
method: "get_user_id",
input_type: "JSON",
response_type: "JSON",
rest_data:'"new_get_user_id":["session":"' + SugarSessionId + '"]'
}, function(data) {
if (data !== undefined) {
var userID = jQuery.parseJSON(data);
}
});
Upvotes: 0
Views: 2125
Reputation: 33
I tried the following and it works for me.
var userID = '';
$.get(CurrentServerAddress + '/service/v4/rest.php', {
method: "get_user_id",
input_type: "JSON",
response_type: "JSON",
rest_data: '[{"session":"' + SugarSessionId + '"}]'
}, function(data) {
if (data !== undefined) {
userID = jQuery.parseJSON(data);
}
});
Upvotes: 2
Reputation: 145
The REST call that you are making requires that you have a SESSION token. Normally, we will setup a REST user on our CRM's that can be accessed via REST.
Upvotes: 0
Reputation: 10012
'authenticated_user_id'
As far as I'm aware that is the sugar crm item in session which you should be looking for, are you requesting that?
Upvotes: 0