Skip to content

GetPdf() type mismatch - can't unmarshal uint8 to string #152

@viewpnt

Description

@viewpnt

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)

}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions