src/Resource/TicketArticle.php
public function getAttachmentContent($attachment_id)
    {
        $attachment_id = intval($attachment_id);
        if (!$attachment_id) {
            throw new \Exception('Attachment ID is invalid');
        }

        if ( empty( $this->getID() ) ) {
            throw new \Exception('Object data does not contain an ID, getAttachmentContent() not possible');
        }

        $this->clearError();

        $attachments = $this->getValue('attachments');
        if ( !is_array($attachments) || !count($attachments) ) {
            return false;
        }

        // Check if given attachment ID exists for article.
        $attachment_key = array_search( $attachment_id, array_column( $attachments, 'id' ) );
        if ( $attachment_key === false ) {
            return false;
        }
        $attachment = $attachments[$attachment_key];

        // Fetch content.
        $url = $this->getURL(
            'get_attachment_content',
            [
                'ticket_id'         => $this->getValue('ticket_id'),
                'ticket_article_id' => $this->getID(),
                'object_id'         => $attachment['id'],
            ]
        );

        $response = $this->getClient()->get($url);
        if ( $response->hasError() ) {
            $this->setError( $response->getError() );
            return false;
        }

        $content = $response->getBody();
        return $content;
    }
public function getAttachmentContent($attachment_id)
    {
        $attachment_id = intval($attachment_id);
        if (!$attachment_id) {
            throw new \Exception('Attachment ID is invalid');
        }

        if ( empty( $this->getID() ) ) {
            throw new \Exception('Object data does not contain an ID, getAttachmentContent() not possible');
        }

        $this->clearError();

        $attachments = $this->getValue('attachments');
        if ( !is_array($attachments) || !count($attachments) ) {
            return false;
        }

        // Check if given attachment ID exists for article.
        $attachment_key = array_search( $attachment_id, array_column( $attachments, 'id' ) );
        if ( $attachment_key === false ) {
            return false;
        }
        $attachment = $attachments[$attachment_key];

        // Fetch content.
        $url = $this->getURL(
            'get_attachment_content',
            [
                'ticket_id'         => $this->getValue('ticket_id'),
                'ticket_article_id' => $this->getID(),
                'object_id'         => $attachment['id'],
            ]
        );

        $response = $this->getClient()->get($url);
        if ( $response->hasError() ) {
            $this->setError( $response->getError() );
            return false;
        }

        $content = $response->getBody();
        return $content;
    }
Fetches the actual content of the file of a ticket article attachment.
Note that the resource object must contain data of saved article (resource object must contain ID of article).

@param integer $attachment_id      ID of attachment to fetch content for.

@return string                     Attachment content or false on error.