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

Updating a SQLite database using Python once an item has been selected from the dropdown suggestions

My program needs to update the "idlist" table in Python after a user selects an item from a drop-down suggestion list in JavaScript. Once the user clicks on the selected item, a POST request is made in Python to add it to the "idlist" table. However, when ...

Clicking on the anchor at the bottom of the page will smoothly navigate you to the top of the page

I added an anchor at the bottom of the page. I wrapped a group of buttons with the link so that when clicked, they trigger the assigned JavaScript and scroll to the bottom of the page. However, the buttons currently execute the JavaScript but then take you ...

The initial JavaScript load shared by all users is quite large in the next.js framework

Currently working on a project using the Next.js framework and facing an issue where the First Load JS shared by all pages is quite heavy. I am looking for advice on possible strategies to reduce the weight of the JS file, and also wondering if there ...

Creating protected routes in ReactJs using Typescript by utilizing a Higher Order Component (HOC) as

I'm struggling to create a basic HOC that can protect a component, ensuring that the user is logged in before rendering the component. Below is my attempt at building the protective HOC (not functional yet). export default function ProtectedRoute(Com ...

Change the width of the webpage inside the iframe

I am working with an iframe that has a fixed width and height of 400px. I want to load a web page in the iframe, but I need to adjust the width of the source to fit my iframe perfectly. The height is not an issue as I can add a scrollbar if needed. Here ...

Error message: "AngularJS encountered a $injector:modulerr error in Internet Explorer 11."

I've successfully created an AngularJS App that functions properly on most browsers like Firefox, Opera, Safari, Edge, and Chrome. However, there seems to be a compatibility issue with IE 11. When attempting to open the app in IE 11, the following er ...

Locate the child element that has a particular class assigned to it

I need help writing a code to search through all children elements in order to find a div with a specific class. Unfortunately, the DIV I am looking for does not have an ID. Below is the sample HTML that I will be working with: <div class="outerBUB ...

Unspecified tag name attribute in Vue that can be accessed in the browser

At the moment, I have encountered an issue with a selector in Vue returning undefined for {{ lens.price }}. However, when I use a = lens[1].getAttribute('price') in the browser console, it correctly displays the value as "0". Why is Vue showing ...

Double Calling of Angular Subscription

I am currently working with a series of observables that operate in the following sequence: getStyles() --> getPrices() Whenever a config.id is present in the configs array, getStyles() retrieves a style Object for it. This style Object is then passed to ...

The issue with JQuery's JSON.stringify function not functioning as expected

Hi everyone, I'm currently working on a project involving a nested menu and I need to update it via API whenever the client moves an item. To achieve this, I am using a jQuery plugin called . The plugin includes an onDrop method as shown in the code s ...

Tips for resolving the 'route.search' bug in Express.js

I recently started working on a basic Express app (with Node) and I am in the initial setup phase. However, I have encountered an error that is proving to be quite challenging to resolve. Despite my attempts to search for solutions online and browse throu ...

Reset the text input field when the dropdown menu is set to 'no/other'

CURRENT: Choosing from a dropdown menu with options 'Yes' or 'No'. If 'Yes' is chosen: Display additional dropdowns/inputs for entry If 'No' is chosen: Conceal additional dropdowns/inputs WANT: I am looking to imp ...

I am facing an issue where the table in my Laravel Vue component is not displaying the data from

Recently, I've been diligently following an instructional series on VUE applications by a highly recommended YouTuber. Every step was meticulously executed until I hit a roadblock out of nowhere. The data from my database refuses to display on the fro ...

Is there a way to conceal a div class on the Payment page in Shopify?

I have encountered an issue with the code on the Shopify checkout (Payment) Page. Unfortunately, I am unable to directly edit this page within Shopify, but I have discovered that it is possible to add custom CSS or HTML code within the checkout settings of ...

What is the equivalent of Node's Crypto.createHmac('sha256', buffer) in a web browser environment?

Seeking to achieve "feature parity" between Node's Crypto.createHmac( 'sha256', buffer) and CryptoJS.HmacSHA256(..., secret), how can this be accomplished? I have a piece of 3rd party code that functions as seen in the method node1. My goal ...

The success function in $.ajax not being triggered

In the .js file, there is a function that invokes a webservice method named getStudents: [WebMethod(Description = "white student list")] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public List<Job> getStudents(long classId) ...

I am experiencing an issue where the result is not appearing on the input tag within my

<script> <form action="do-add-cek.php" id="myForm" method="post" enctype="multipart/form-data"> <div class="form-group"> <label> ...

Numerous options available in a dropdown menu

I have a Dropdown menu that offers various functions. "Update" option redirects to a page for updating information "Export Form" option redirects to a page for exporting the form Although the current code allows these actions, I am facing an issue with ...

What is the best location in Backbone.js to store code unrelated to the view, such as ads and analytics?

In my development of a backbone.js application, I have come to understand the role of each backbone "class" as follows: Model: This represents the data object, where the outcome of an API call is stored. Collection: An organized group of models, for exam ...

Missing ghost image appears when you drag and drop the file

New to JavaScript... As a rookie in coding, I often get interesting requests from my partner who is a kindergarten teacher. Recently, she asked me to create a "Function Machine" for her classroom activities. With some trial and error, I managed to put tog ...