Viital
5 years agoContributing User
Attaching PDF to bill API
Hi I have had the below working for several months but about a week ago this stopped working. Did the API receive an update?
{ "Errors": [ { "Name": "InternalError", "Message": "An exception was thrown that was not handled correctly. If this situation persists please contact developers@myob.com for further assistance.", "AdditionalDetails": null, "ErrorCode": 20, "Severity": "Error", "LearnMore": null } ], "Information": "Warning, error messages have not been finalised in this release and may change" }
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://ar2.api.myob.com/accountright/cf....fd/Purchase/Bill/Service/bf7....68/Attachment', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "Attachment": { "OriginalFileName": "me.pdf", "FileBase64Content": "JVBER.....==" } }', CURLOPT_HTTPHEADER => array( 'x-myobapi-key: secretkey', 'x-myobapi-version: v2', 'Accept-Encoding: gzip,deflate', 'Content-Type: application/json', 'Authorization: Bearer AAE.......uw' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;