{"action":"created","issue":{"url":"https://api.github.com/repos/helpscout/helpscout-api-php/issues/21","labels_url":"https://api.github.com/repos/helpscout/helpscout-api-php/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/helpscout/helpscout-api-php/issues/21/comments","events_url":"https://api.github.com/repos/helpscout/helpscout-api-php/issues/21/events","html_url":"https://github.com/helpscout/helpscout-api-php/issues/21","id":69323697,"number":21,"title":"Upload attachments","user":{"login":"ifpingram","id":1426859,"avatar_url":"https://avatars.githubusercontent.com/u/1426859?v=3","gravatar_id":"","url":"https://api.github.com/users/ifpingram","html_url":"https://github.com/ifpingram","followers_url":"https://api.github.com/users/ifpingram/followers","following_url":"https://api.github.com/users/ifpingram/following{/other_user}","gists_url":"https://api.github.com/users/ifpingram/gists{/gist_id}","starred_url":"https://api.github.com/users/ifpingram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifpingram/subscriptions","organizations_url":"https://api.github.com/users/ifpingram/orgs","repos_url":"https://api.github.com/users/ifpingram/repos","events_url":"https://api.github.com/users/ifpingram/events{/privacy}","received_events_url":"https://api.github.com/users/ifpingram/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-18T16:20:47Z","updated_at":"2015-05-22T15:12:13Z","closed_at":"2015-05-22T15:12:13Z","body":"Hi\r\n\r\nThere is a bug in the uploading of attachments. I have \"fixed\" it locally (i.e. dirty hack to make it work!), but i'm afraid I've not got time to do a proper fix with PR etc. Here's the relevant code: \r\n\r\nApiClient.php\r\n\r\nlines 448 - 458: The json_decode is already decoded in doPost line 897, so I have pulled it out. Also, needed to change from accessing variables are stdClass and use array access, due to the json_decode as array on line 897.\r\n\r\n```php\r\n\t/**\r\n\t * @param  \\HelpScout\\model\\Attachment $attachment\r\n\t * @return void\r\n\t */\r\n\tpublic function createAttachment(Attachment $attachment) {\r\n\t\tlist(,$body) = $this->doPost('attachments.json', $attachment->toJson(), 201);\r\n\r\n\t\tif ($body) {\r\n\t\t\t$attachment->setHash($body['item']['hash']);\r\n\t\t}\r\n\t}\r\n```\r\n\r\nlines 904-907 - this is a nasty hack using error suppression. I guess you will need to work out a proper fix, but this will probably need some thought...\r\n\r\n```php\r\n\t\treturn array(\r\n\t\t\t$this->getIdFromLocation(@$response->headers['Location']),\r\n\t\t\t$response->body\r\n\t\t);\r\n```\r\n\r\nHope this helps - even if you don't use the fixes, it alerts you to the issue.\r\n\r\nThanks & regards\r\n\r\nIngram"},"comment":{"url":"https://api.github.com/repos/helpscout/helpscout-api-php/issues/comments/104685140","html_url":"https://github.com/helpscout/helpscout-api-php/issues/21#issuecomment-104685140","issue_url":"https://api.github.com/repos/helpscout/helpscout-api-php/issues/21","id":104685140,"user":{"login":"stevenwadejr","id":1508485,"avatar_url":"https://avatars.githubusercontent.com/u/1508485?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenwadejr","html_url":"https://github.com/stevenwadejr","followers_url":"https://api.github.com/users/stevenwadejr/followers","following_url":"https://api.github.com/users/stevenwadejr/following{/other_user}","gists_url":"https://api.github.com/users/stevenwadejr/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenwadejr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenwadejr/subscriptions","organizations_url":"https://api.github.com/users/stevenwadejr/orgs","repos_url":"https://api.github.com/users/stevenwadejr/repos","events_url":"https://api.github.com/users/stevenwadejr/events{/privacy}","received_events_url":"https://api.github.com/users/stevenwadejr/received_events","type":"User","site_admin":false},"created_at":"2015-05-22T15:12:13Z","updated_at":"2015-05-22T15:12:13Z","body":"HI @ifpingram, thanks so much for pointing this out and posting the fixed code. We've incorporated your fixes and have published a new [1.5.2](https://github.com/helpscout/helpscout-api-php/releases/tag/1.5.2) release.\r\n\r\nI hope this helps!"}}