Retreive Attachments via API

Problem reported by Nick _ 2 weeks ago

Hello,

We're using the API to add attachments to purchase and invoice documents. This works fine. We can also list existing attached files back.

We're struggling to download a previously attached file.

https://api.clearbooks.co.uk/v1/accounting/purchases/{purchaseType}/{purchaseId}/attachments will return a JSON array of attachments for a particular purchaseID.

https://api.clearbooks.co.uk/v1/accounting/purchases/{purchaseType}/{purchaseId}/attachments/{attachmentId} returns a single element of that same array. It feels like this end point should return the binary file instead?

OR: Is there a standard URI we can plumb the filename in to to get the file back? The CDN URI looks formulaic: https://files.clearbookscdn.uk/{businessID}/attachments/scans/{randomFilename.ext} So it would just be the {randomFilename.ext} key that's needed to be returned via one of the end points to connect this up.

many thanks,

3 Replies

Hi Nick,

No problem, and I don't have a rough ETA unfortunately. It will be weeks/ months range.

Tommy

Thanks Tommy,

That would be a great solution. Direct URL for the resource.

Are you able to put a rough target on 'soon' please? Days, weeks, months?

thanks,

Hi Nick,

Yes, that's currently a known gap with the API (and actually intentional for now). The plan is to add the CDN URLs to the responses once we've completed some upgrades, and we should hopefully be able to do that soon.

Tommy

Reply to this problem

Attach images by dragging and dropping or upload
 

Your comments will be public and can be answered by anyone in the Clear Books community.

Find out what we do and who we are