Using the API to create a new ticket sometimes returns an existing ticket | Community
Skip to main content

Using the API to create a new ticket sometimes returns an existing ticket

  • May 30, 2024
  • 2 replies
  • 0 views

Arnon

Hi,

I have a weird issue that I can't manually reproduce, but it rarely happens, and I have no idea why.
I have a script that creates a new ticket (POST /api/v2/tickets.json) multiple times a day and in most cases, a new ticket is created every time (code 201). 

However, in some cases, no ticket is created and the response contains a similar ticket that I made earlier (code 200).

 

The response body object for both POST requests is even different in both cases.

When it creates a ticket, the response is:

{
  "ticket": {
    "subject": "Subject content",
    "updated_at": 1716929554,
    "organization_id": "91********",
    ...
    "id": "12345678",
    "status": "open",
    "requester_id": "51********",
    "assignee_id": "51********"
  },
  "audit": {
  	...
  }
}

and when it doesn't, the response is:

{
  "tickets": [
    {
      "subject": "Subject content",
      "updated_at": 1716929554,
      "organization_id": "91********",
      ...
      "id": "12345678",
      "status": "open",
      "requester_id": "51********",
      "assignee_id": "51********"
    }
  ]
}

As I mentioned, I can't manually reproduce it but I suspect it's related to the “external_id” field which is identical in both cases. Maybe this field or any other similarity between the requests causes Zendesk to think it's a duplicate and not create a new ticket.
But if that was the case, why is it happening very rarely?

 

Does anyone have an idea what could cause this behavior?

 

Thanks

 

2 replies

Tipene
  • June 26, 2024
Hi Arnon,
 
Can you let me know the last time you observed this behavior? I'll take a look in the logs and see if I can surface any more details.
 
Thanks,
 
Tipene

Arnon
  • Author
  • July 16, 2024

Hi Tipene,

The last time we noticed it was on May 28. If you still have the relevant logs, anything you can find or think of would help us a lot.

 

Thanks,

Arnon