AvaTax-REST-V2-JS-SDK
AvaTax-REST-V2-JS-SDK copied to clipboard
DownloadCertificateImage ends with is not valid JSON error
Hello,
I am trying to download a PDF file of an existing certificate. For this purpose, I am using the downloadCertificateImage function, but every call ends with a not valid JSON error.
this.avaTaxClient.downloadCertificateImage({ companyId, id, type: CertificatePreviewType.Pdf })
The full message:
{"httpMethod":"get","correlationId":"6bcf75cb-7304-4f99-a241-279837419ab6","requestURI":"https://sandbox-rest.avatax.com/api/v2/companies/7978474/certificates/42208/attachment?%24type=2","totalExecutionTime":1763,"statusCode":200,"timestamp":"Mon, 29 Apr 2024 09:59:26 GMT","errorInfo":{"code":"FormatException","details":{"message":"invalid json response body at https://sandbox-rest.avatax.com/api/v2/companies/7978474/certificates/42208/attachment?%24type=2 reason: Unexpected token '�', \"����\u0000\u0010JFIF\"... is not valid JSON","type":"invalid-json"}}
I also tried using your API directly and calling endpoint /api/v2/companies/{companyId}/certificates/{id}/attachment (which I guess is used by this function) and it works as expected.