Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not parsing audit part of response after updating a ticket. #257

Open
hchienjo opened this issue Feb 8, 2023 · 6 comments
Open

Not parsing audit part of response after updating a ticket. #257

hchienjo opened this issue Feb 8, 2023 · 6 comments
Labels
API Support New API support

Comments

@hchienjo
Copy link

hchienjo commented Feb 8, 2023

After updating a ticket, only the ticket part of the response from zendesk is parsed and the audit part is discarded. Is it possible to add it as we have encountered a use case for that?

@nukosuke
Copy link
Owner

nukosuke commented Feb 8, 2023

What endpoint are you using?
I guess that response of Ticket API doesn't have audit info. You could use Ticket Audit API instead.

https://pkg.go.dev/github.com/nukosuke/go-zendesk/zendesk#Client.GetTicketAudits

@nukosuke nukosuke added the Question Further information is requested label Feb 8, 2023
@hchienjo
Copy link
Author

hchienjo commented Feb 8, 2023

PUT request to /api/v2/tickets/{ticketID}.json to update a ticket, like for example adding a comment to a ticket.

@nukosuke
Copy link
Owner

nukosuke commented Feb 8, 2023

audits can be retrieved only from dedicated endpoint, maybe.
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_audits/#list-audits-for-a-ticket

So, you should send another GET request to /api/v2/tickets/{ticket_id}/audits after updating the ticket.

@hchienjo
Copy link
Author

hchienjo commented Feb 8, 2023

In the example from zendesk documentation after updating a ticket, the response payload has an audit event. I am thinking of a case where you want to see the audit of changes done to the ticket directly related to the update you have just done.

@nukosuke
Copy link
Owner

nukosuke commented Feb 8, 2023

oh, I didn't know. Thank you for the information.

Then, this method seems discard "audit" payload as you said.

func (z *Client) UpdateTicket(ctx context.Context, ticketID int64, ticket Ticket) (Ticket, error) {
var data, result struct {
Ticket Ticket `json:"ticket"`
}

I am thinking of a case where you want to see the audit of changes done to the ticket directly related to the update you have just done.

To support this case, we should add new method which returns audit events.

@nukosuke nukosuke added API Support New API support and removed Question Further information is requested labels Feb 8, 2023
@hchienjo
Copy link
Author

Will you be able to work on it? I can take this up given the name that you want for the new method name?
Maybe we can call it UpdateTicketWithAudit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Support New API support
Projects
None yet
Development

No branches or pull requests

2 participants