Xero API file attachments

Has anyone else set up the xero api for file attachments. Hopefully someone can solve this for me. I creating the bill/invoice and collecting the id from xero but im stuck trying to get this api to work to attach the pdf file.