Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

RetrieveFax

Michael Fridman edited this page Mar 18, 2018 · 5 revisions

See the official Retrieve_Fax docs for more info.


Only a single SRFax job can be retrieved (downloaded) at a time. The download format can be specified with options as either PDF or TIFF; defaults to account settings if unspecified.

An example of retrieving an Inbox (inbound) item, see comments for more details:

opts := srfax.RetrieveOptions{
	FaxFormat: "PDF",
}

resp, err := client.RetrieveFax("383726044", "IN", opts)
if err != nil {
	log.Fatalln(err)
}

// *RetrieveResp has convenience method to decode 
// the base64-encoded Result string into []byte
data, err := resp.DecodeResult()
if err != nil {
	log.Fatalln(err)
}

// write out data to a file
if err := ioutil.WriteFile("sample.pdf", data, 0644); err != nil {
	log.Fatalln(err)
}