Hi there,
I’m having some trouble attaching documents to invoices through zapier.
I have the following POST request setup but continue to get the error “Symfony\Component\Debug\Exception\FatalThrowableError”
I do believe I have the request formatted correctly but was wondering if I can get someone to take a look and steer me in the right direction?
I’ve also tried the following python code and can’t get it to work
import requests
file = ‘https://pdf-temp-files.s3.amazonaws.com/4bba1d9d6f3f45a285485de5e371f193/time_sheet.pdf’
headers = {}
headers[‘X-Ninja-Token’]= ‘axby0uqadrprstomsjvao4eocdbj9as9’
headers[‘Content-Type’]= ‘multipart/form-data’
headers[‘X-Requested-With’]= ‘XMLHttpRequest’
url = ‘https://app.invoiceninja.com/api/v1/documents?invoice_id=929’
r = requests.post(url, headers=headers,files={‘file’: file})
r.status_code
hillel
3
I assume you’re using the v4 app?
Here’s an example, you need to set the invoice_id, token and filename
curl -X POST https://domain.com/api/v1/documents?invoice_id=<your_id> \
-H 'Content-Type: multipart/form-data' \
-H 'X-Ninja-Token: TOKEN' \
-H 'X-Requested-With: XMLHttpRequest' \
-F 'file=@filename.png'
In the example I do set the invoice id = 929
The file is from a url, so could that be causing the issue? How would you do it in a curl request if the file is from a url?
hillel
5
I’m not sure if that’s possible, you may need to download the file first.
I’ve been achieve this via zapier until very recently. The image is the example of how I’m doing it.
hillel
7
Are you saying this was working and then stopped working? In your initial post you implied you were tying to set this up.
It was working formerly yes
But now I’m getting an error “Symfony\Component\Debug\Exception\FatalThrowableError”.
hillel
10
Can you please check when was the last time it worked correctly?