I was wondering if there is a way to identify the user based on the API Token. As we have a need to know who is subject that wants to utilise certain services that depend on FreshDesk API.
Is there a way that this can be achieved, or maybe something planned for the future?
Yes, unfortunately, non-admin users can’t able to access the API as per documentation.
not be possible to identify non-admin users?
If you want to identify the user role, you can use the below endpoint to get the roles. Only users with admin privileges can access the below endpoint
https://domain.freshdesk.com/api/v2/roles below is the sample response.
[
{
"id" : 1,
"name" : "Account Administrator",
"description" : "Has complete control over the help desk including access to Account or Billing related information, and receives Invoices.",
"default" : true,
"created_at" : "2016-02-29T06:32:28Z",
"updated_at" : "2016-02-29T06:32:28Z"
}
]
Now from the logged-in user object, you can find the role_ids key which will be the array if the ID ( To get the role id you can use the above API ) of the Admin role is present in the array, then the logged-in user is an admin.