AvaTax-REST-V2-JS-SDK icon indicating copy to clipboard operation
AvaTax-REST-V2-JS-SDK copied to clipboard

DownloadCertificateImage ends with is not valid JSON error

Open Arcus16 opened this issue 1 year ago • 0 comments

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.

Arcus16 avatar Apr 29 '24 10:04 Arcus16