assignee name by using assignee_id



Posted Jan 31, 2024

getting name of assignee using an api request 
when we have assignee_id .

Greg Katechis


0

6

6 comments

No, i need to get the most recent comments of the ticket....do you have a API to get recent comments.
if there...what are the scopes required to read the comments of the ticket.
Kuba respond 

 

 

0


Yes, you can obtain the name of the agent who acted on a ticket using the Zendesk API, but it requires an additional step after retrieving the comments.

The GET /api/v2/tickets/{ticket_id}/comments endpoint provides you with an author_id, which corresponds to the user who made the comment.

To get the name of the author from the author_id, you need to make a separate API call to the GET /api/v2/users/{user_id} endpoint. 

0


similarly are there any API's to get the recent comments on a ticket..with the name of person who commented or assisted that respective ticket
Kuba

 

0


Unfortunately, there is no API that would get assignee name within ticket object, this would require to make two calls, one to Ticket API to get the assingee_id and then use it to call User API and get their name

0


is there an API that allows you to retrieve the assignee name by providing the assignee ID in the request body call.well, i need the assignee name to be displayed with the ticket so...do we have an API
Kuba

0


Hey shiva pulicharla

If I understand correctly your request, you would like to get the name of assignee based on their id.

You can call the User API to get this information following this documentation:

GET: /api/v2/users/{user_id} and use the assignee id to get your user data. This call should return a JSON object with the user's details, including their name.

The Zendesk API does not provide a direct way to fetch only a specific field, such as the name, from the user object in the response. 

You will receive the full user object, and you will need to parse the JSON response to extract the name field. This is typically done in the code of the application that is making the API call.

For example, if you are using JavaScript, you would do something like this:


fetch('https://subdomain.zendesk.com/api/v2/users/assignee_id.json')
  .then(response => response.json())
  .then(data => {
    const assigneeName = data.user.name;
    console.log(assigneeName); // This will log the name of the assignee to the console
  })
  .catch(error => console.error('Error:', error));

Here is a test I ran with this method: 

0


Sign in to leave a comment.

Didn't find what you're looking for?

New post