Create bill with pdf attachment

Hello.

I need to create a bill with a pdf attachment using the API.

Everything works as expected except when I add the attachment attribute (object). Leaving the attachment attribute out creates the bill but then I need to manually add the attachment through the Freeagent web GUI.

Any advice would be greatly appreciated.

Request and response from Google OAuth 2.0 Playground here:
http://www.dunedintrading.com/Invoices/freeagent_api_request_response.txt

Hi Mario,

As per the documentation for the bills endpoint (https://dev.freeagent.com/docs/bills), the PDF data needs to be base64 encoded and included in the request, along with the file name and content type.

Explanation attachment (max 5MB), in the following format:

data (binary data of the file being attached encoded as base64)
file_name
description
content_type can be one of the following:
image/png, image/x-png, image/jpeg, image/jpg, image/gif, application/x-pdf

Hope that helps,
Paul