Error API GET Attachment (contents)

Forum dedicated to Mods for HESK created by Mike Koch

Moderator: mkoch227

Post Reply
davidoff22
Posts: 2
Joined: Sat Sep 15, 2018 12:55 pm

Error API GET Attachment (contents)

Post by davidoff22 »

HESK Version: 2.8.2 - HESK ist aktuell
Mods für HESK Version: 2018.2.0 - Mods for HESK ist aktuell
PHP-Version: 7.2.9 (MySQLi)
MySQL-Version: 5.6.41
/hesk_settings.inc.php Vorhanden, Schreibrechte vorhanden
/attachments Vorhanden, Schreibrechte vorhanden
/cache Vorhanden, Schreibrechte vorhanden

Hosting company: campusspeicher
URL of phpinfo.php: https://ticketing.weingaertner.it/phpinfo.php
Write your message below:

I am trying to download the ticket attachments via API (/staff/tickets/:ticketId/attachments/:attachmentId). I am using the same x-auth-token as for retrieving the tickets (which is working properly).

Http-Client reports: Fought an uncaught exception. Check the logs for more information. Log ID: 34.

Log Entry 34:
REST API: ClassDefinitionResolver

Message:
Entry BusinessLogic\Attachments\AttachmentRetriever cannot be resolved: The parameter 'attachmentGateway' of BusinessLogic\Attachments\AttachmentRetriever::__construct has no value defined or guessable Full definition: Object ( class = BusinessLogic\Attachments\AttachmentRetriever scope = singleton lazy = false __construct( $attachmentGateway = #UNDEFINED# $fileReader = #UNDEFINED# $ticketGateway = #UNDEFINED# $userToTicketChecker = #UNDEFINED# ) )

Stack Trace:
#0 /var/www/vhosts/h169235.server53.campusspeicher.de/ticketing.weingaertner.it/hesk/api/vendor/mike-koch/php-di/src/DI/Definition/Resolver/ClassDefinitionResolver.php(203): DI\Definition\Exception\DefinitionException::create(Object(DI\Definition\ClassDefinition), 'Entry BusinessL...')
#1 /var/www/vhosts/h169235.server53.campusspeicher.de/ticketing.weingaertner.it/hesk/api/vendor/mike-koch/php-di/src/DI/Definition/Resolver/ClassDefinitionResolver.php(82): DI\Definition\Resolver\ClassDefinitionResolver->createInstance(Object(DI\Definition\ClassDefinition), Array)
#2 /var/www/vhosts/h169235.server53.campusspeicher.de/ticketing.weingaertner.it/hesk/api/vendor/mike-koch/php-di/src/DI/Container.php(294): DI\Definition\Resolver\ClassDefinitionResolver->resolve(Object(DI\Definition\ClassDefinition), Array)
#3 /var/www/vhosts/h169235.server53.campusspeicher.de/ticketing.weingaertner.it/hesk/api/vendor/mike-koch/php-di/src/DI/Container.php(123): DI\Container->resolveDefinition(Object(DI\Definition\ClassDefinition))
#4 /var/www/vhosts/h169235.server53.campusspeicher.de/ticketing.weingaertner.it/hesk/api/Controllers/Attachments/StaffTicketAttachmentsController.php(21): DI\Container->get('BusinessLogic\\A...')
#5 [internal function]: Controllers\Attachments\StaffTicketAttachmentsController->get('1', '6')
#6 /var/www/vhosts/h169235.server53.campusspeicher.de/ticketing.weingaertner.it/hesk/api/Link.php(220): call_user_func_array(Array, Array)
#7 /var/www/vhosts/h169235.server53.campusspeicher.de/ticketing.weingaertner.it/hesk/api/Link.php(113): Link::callFunction('Controllers\\Att...', Array, 'GET', Array)
#8 /var/www/vhosts/h169235.server53.campusspeicher.de/ticketing.weingaertner.it/hesk/api/index.php(251): Link::all(Array)
#9 {main}

Do you have any ideas? Thanks in advance for your reply.

Regards
David
mkoch227
Posts: 666
Joined: Wed Jul 04, 2012 3:37 pm

Re: Error API GET Attachment (contents)

Post by mkoch227 »

Yep, definitely a bug :wink: . Replace the contents in /api/BusinessLogic/Attachments/AttachmentRetriever with the contents here:

https://gitlab.com/mike-koch/Mods-for-H ... riever.php
Mike, Lead Developer of Image HESK: A surprisingly simple, user-friendly and FREE help desk software with integrated knowledgebase.
davidoff22
Posts: 2
Joined: Sat Sep 15, 2018 12:55 pm

Re: Error API GET Attachment (contents)

Post by davidoff22 »

Thanks Mike, works fine.
Regards David
eebee
Posts: 1
Joined: Thu Apr 11, 2019 11:14 am

Re: Error API GET Attachment (contents)

Post by eebee »

Hi!

I've got the same error, and the updated file fixed the problem for GET in the attachments.

Now, I got the same-ish issue when I try to POST attachments to my tickets.

https://xxxx.xxxx.xx/api/index.php/v1/s ... ttachments

JSON-body:

Code: Select all

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iLWV/Xm9NHwESFRHec9aNRQS8BL2ScijmT+5ryBgm4ulDiQCz4cD/nJgGDzRI7Y8FUyqxuAi60VqAhzplul3WWgN5l27AizjN9XEYXAT1SElNxnplLEp0EnFdXjy9xvpk7w8PD1wjoJoWx+L/rDBBwji013ItFbusnoAspLsZiD/oJOKOqctei6rZYYmyBgNNejVQO/d4QSz2tnkDa9nr7D/oVS41/w0mJpU1GYxl/cUJGixuxHHTIWNPQFstBu6yWxX9iGTgmq3HteCwDR83aeyuWgSNm7WiNZeCwnD2TsRQOydn9MJb6B+S/FQZY1hobAAAAAElFTkSuQmCC"
}
Error in Postman:

Code: Select all

{
    "type": "ERROR",
    "title": "SQL Exception",
    "message": "Fought an uncaught SQL exception. Check the logs for more information. Log ID: 72",
    "logId": 72
}
Error in tracestack:

Fought an uncaught SQL exception: MySQL svarade: Unknown column 'note_id' in 'field list'

Code: Select all

#0 /home/xxx/public_html/xxx/api/DataAccess/Attachments/AttachmentGateway.php(23): hesk_dbQuery('INSERT INTO `he...')
#1 /home/xxx/public_html/xxx/api/BusinessLogic/Attachments/AttachmentHandler.php(89): DataAccess\Attachments\AttachmentGateway->createAttachmentForTicket(Object(BusinessLogic\Attachments\TicketAttachment), Array)
#2 /home/xxx/public_html/xxx/api/Controllers/Attachments/StaffTicketAttachmentsController.php(45): BusinessLogic\Attachments\AttachmentHandler->createAttachmentForTicket(Object(BusinessLogic\Attachments\CreateAttachmentForTicketModel), Object(BusinessLogic\Security\UserContext), Array)
#3 /home/xxx/public_html/xxx/api/Link.php(220): Controllers\Attachments\StaffTicketAttachmentsController->post('166')
#4 /home/xxx/public_html/xxx/api/Link.php(113): Link::callFunction('Controllers\\Att...', Array, 'POST', Array)
#5 /home/xxx/public_html/xxx/api/index.php(250): Link::all(Array)
#6 {main}
Any ideas?
Post Reply