Zendesk更新票证有几条评论

时间:2014-10-06 03:04:47

标签: javascript json zendesk

我正在尝试通过他们的API更新Zendesk中的一张票,并附上几条评论。显然,似乎我使用了错误的格式,因为评论没有出现在我的Zendesk仪表板中......

我使用以下格式(JSON):

{
      "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]
      }
    };

谁能看到我做错了什么?

提前多多感谢!

1 个答案:

答案 0 :(得分:1)

创建评论时不需要id密钥;您在创建评论时会自动为其分配ID。它实际上是故障单事件的ID,您可以使用审计API访问该事件:https://developer.zendesk.com/rest_api/docs/core/ticket_audits#audit-events

删除id密钥应解决一次提交单个评论的问题,如下所示:

{
      "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]
      }
    };

此外,(我非常确定)comments密钥不接受单个故障单更新的一系列评论,因此您需要为每个故障单进行多次呼叫评论(即每条评论的单一票证更新)。