Updating a Zendesk ticket with multiple comments

I've been attempting to update a ticket on Zendesk using their API and adding multiple comments. However, it seems that I might be utilizing the incorrect format as the comments are not showing up on my Zendesk dashboard...

The JSON format I'm currently using is:

{
      "ticket" : {
        "external_id":      externalID,
        "created_at":       incomingTicket.startDate,
        "updated_at":       incomingTicket.lastModificationDate,
        "type":             lType,
        "subject":          incomingTicket.topic,
        "description":      incomingTicket.description,
        "priority":         lPriority,
        "status":           lStatus,
        "comments":         [{"id": 3456, "body": "First comment Fix"}, {"id": 3457, "body": "Second Command Fix"}],
        "due_at":           incomingTicket.endDate,
        "tags":             [incomingTicket.label]
      }
    };

Could someone please point out where I might be going wrong?

Thank you very much in advance!

Answer №1

When creating a comment, there is no need to include the id key as it will be automatically assigned. This id actually refers to a ticket event, which can be accessed through the audit API:

To submit a single comment at a time, you should omit the id key like this:

{
      "ticket" : {
        "external_id":      externalID,
        "created_at":       incomingTicket.startDate,
        "updated_at":       incomingTicket.lastModificationDate,
        "type":             lType,
        "subject":          incomingTicket.topic,
        "description":      incomingTicket.description,
        "priority":         lPriority,
        "status":           lStatus,
        "comments":         {"body": "First comment Fix"},
        "due_at":           incomingTicket.endDate,
        "tags":             [incomingTicket.label]
      }
    };

It's worth mentioning that the comments key does not support an array of comments for a single ticket update. Therefore, multiple calls will be needed for each comment (i.e., one ticket update per comment).

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Effortlessly find data in an HTML table and showcase the results instantly without

I am looking for a way to implement search functionality in my table without refreshing the page. The fields above the table are used for searching and I want the results to be displayed within the same table. Here is an example of the code: <?php $for ...

What is the best way to implement dynamic generation of Form::date() in Laravel 8?

Is there a way to dynamically generate the Form::date() based on the selection of 1? If 1 is selected, then display the Form::date() under the Form::select(). However, if 0 is selected, then hide the Form::date() in this particular view. For example: Sel ...

Unable to retrieve data with $.getJSON

I've hit a roadblock in finding the answer, so I created a temporary workaround - but unfortunately, it's not usable in the final file. Interestingly, when the JSON array is directly embedded in my JavaScript file, everything functions as expect ...

React BrowserRouter causing issues with "invalid hook calls"

Just starting out with React and I am working on setting up paths using BrowserRouter, Route, and Routes in my code. import React from "react" import "./App.css"; import { BrowserRouter as Router, Route, Routes } from 'react-router ...

Evaluating Vue.js Watchers using Jasmine

I want to write a test for a VueJS watcher method, in order to verify if it's being called. The watcher method in my component is structured like this: watch: { value: (newValue, oldValue) => { if (newValue.Status === 'Completed') ...

"Step-by-step guide on creating a popup window for editing a row using ng-grid and AngularJS

I recently started diving into angular-js and I'm really impressed with how cool it is. In my search, I came across http://angular-ui.github.io/ng-grid/, which seems to be a user-friendly tool. However, I'm grappling with figuring out how to disp ...

How can I ensure that Mongoose is case sensitive?

Currently, our authentication system is case sensitive for the email input. However, I would like to make it case insensitive. Here is the function in question: Auth.authenticate({ email, password }) Auth represents a mongoose Model that stores users in ...

Using Javascript to perform redirects within a Rails application

Currently working on a Facebook application using Rails. There are certain pages that require users to be logged in, otherwise they will be directed to a "login" page. I am unable to use redirect_to for this purpose as the redirection must be done through ...

Unable to retrieve information from JSON file utilizing AngularJS version 1.6

I'm having trouble retrieving data from my JSON file using AngularJs 1.6 myApp.controller("homeCtrl", function($scope, $http) { $scope.Data = []; var getJsonData = function() { $http.get('contactlist.json').then(func ...

Using React to retrieve an object from a helper method through a GET request

I am in the process of turning a frequently used function in my application into a helper method that can be imported wherever it is needed. However, I am facing an issue where I am not getting a response from the function when calling it. I need to figure ...

Preserve object properties while allowing for changes to be made without affecting

I am in need of transferring specific properties from one object to another while ensuring that the original object remains mutable. Here is the original object: var sourceObject = { "key1": "value1", "key2": "value2 ...

ng-enter animation not working for ui-view nested within another ui-view after page reload

It seems like the issue lies with the ng-enter event not being properly triggered in the lowest level of the ui view hierarchy. I'm unsure how to resolve this problem effectively. In my extensive angularjs application, nested sub-views work flawlessl ...

Using Python to export several pieces of data to a JSON file

I'm currently developing an address book application in Python, and I'm facing a challenge while attempting to store the data (name, town, & address) in a JSON file. The issue lies in the fact that each time it saves to the JSON file, a new obje ...

When JSON data is displayed in an HTML table, it mysteriously duplicates

I was able to retrieve the data using this code, but I am encountering an issue where the data is being displayed multiple times for certain entries. For example, "tom" might appear as tom, tom, tom... <div class="row"> <div class="col-12"> ...

Unable to make changes to the text within the textarea field

Currently, I am in the process of creating a script to streamline the tedious task of providing teaching feedback. To scrape data such as student names and classes, I am utilizing selenium/python. While everything is running smoothly, I have encountered an ...

Transitioning from the Play mode to the Pause mode upon pressing the Set button

Is there a way to make the button switch from play to pause once the 'Set' button is clicked? Clicking on 'Set' should change the SVG to display the pause button icon. Snippet of Code: https://jsfiddle.net/192h0w85/195/ (function ...

Ajax request terminates once PHP has looped for a specific duration of time (2 minutes)

My challenge involves a button that is responsible for checking over 300 posts for a specific value and other conditions using about 20 if-else statements. Strangely, the ajax call initiated by this button halts after completing around 73 loops within a sp ...

Personalizing keyboard shortcuts in Visual Studio 2013

I am seeking to create a shortcut key that will automatically insert my signature and the current date and time into comment codes. This way, I can easily track when and by whom changes were made in the future. Upon searching online, I discovered that I ...

What is the best approach for submitting a form with data through a POST request in an Ionic application?

I am facing an issue while trying to make a POST request in Ionic for submitting a form with an array of data. Surprisingly, it works perfectly fine when I test it on POSTMAN. Although I attempted to use this form, it did not yield the desired results: ...

Identify the page search function to reveal hidden content in a collapsible section

Our team has implemented an expandable box feature on our wiki (in Confluence) to condense information, using the standard display:none/block method. However, I am looking for a way to make this work seamlessly with the browser's find functionality. S ...