-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Labels
Description
Hi:
I'm trying to save a pdf or excel invoice, but I get an error after the call to getPdf() or getExcel()
- reading body error: type mismatch - can't unmarshal uint8 to string
With sess.Debug = true I can see the base64 encoded pdf but I'm unable to save the result to a file.
Is there a bug with this methods? or I'm doing something wrong?
package main
import (
"fmt"
"io/ioutil"
"github.com/softlayer/softlayer-go/services"
"github.com/softlayer/softlayer-go/session"
)
func main() {
sess := session.New()
sess.Debug = true
invoiceService := services.GetBillingInvoiceService(sess)
pdf, err := invoiceService.Id(9359539).GetPdf()
if err != nil {
fmt.Printf("\n Unable to retrieve invoice's Pdf:\n - %s\n", err)
return
}
ioutil.WriteFile("/tmp/invoice.pdf", pdf, 0644)
}