How to get ticket attachment by API (PHP)

2 Kommentare

  • Satria Faestha
    Aktionen für Kommentare Permalink

    Okay. I got the answer from

    But I still need to modify Zendesk/API/Resources/Core/Attachments.php to add new function 'comments'. it seems the naming not good and confusing but it's working for me.

    protected function setUpRoutes()
          'upload' => "uploads.json",
          'deleteUpload' => "uploads/{token}.json",
          'show' => "attachments/{id}.json",
          'comments' => "tickets/{id}/comments.json"

    public function comments($id=null)
       $response = Http::send(
          $this->getRoute(__FUNCTION__, ['id' => $id]),
          ['method' => 'GET']

       return $response;

    Then I call the function like this:
    $attachments = $client->attachments()->comments($ticketId);

  • Greg - Community Manager
    Aktionen für Kommentare Permalink

    Thank you for sharing your solution, Satria Faestha! IF you've moved this into further testing/production, could you let us know if you've run into any problems with this? If so, please let us know to see if we can help.


Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Powered by Zendesk