pats721
October 27, 2020, 12:17pm
21
Yes, I did put the full path on my PC. Here is my most up to date curl request that returned this error.
curl -X POST URL/api/v1/documents
-H 'Content-Type: multipart/form-data' \
-H 'X-Ninja-Token: TOKEN' \
-H 'X-Requested-With: XMLHttpRequest' \
-F 'file=@C:/Users/CWilliams/Documents/TemplateFiletest/TEST.txt'
hillel
October 27, 2020, 12:55pm
22
I suggest trying with file in the same folder where you’re running curl
Also, it looks like the invoice_id parameter is missing from the URL
pats721
October 27, 2020, 1:07pm
23
Moving the file to the same folder did not change anything. I am still getting the same error.
I was just testing with an without the invoice id parameter to see if it made any difference. It return the same error either way.
hillel
October 27, 2020, 1:11pm
24
Sorry, I’m not sure. It’s working correctly for me.
pats721
October 27, 2020, 3:33pm
25
Is there a way to debug this further to see why the file is not sending when I have it in my request? I am not sure where to go from here.
hillel
October 27, 2020, 4:27pm
26
If you’re developer I can try to help you debug the code
pats721
October 27, 2020, 4:40pm
27
I am a developer. I am just running the curl request in VS Code at this point. I just wanted to get a simple curl request working before integrating my application to use the documents API.
hillel
October 27, 2020, 6:14pm
28
Could it be related to VS Code? Have you tried running the cURL from the command line?
Here’s the relevant code if you want to try to debug the request:
'documents.user_id',
'invoices.public_id as invoice_public_id',
'invoices.user_id as invoice_user_id',
'expenses.public_id as expense_public_id',
'expenses.user_id as expense_user_id'
);
return $query;
}
public function upload($data, &$doc_array = null)
{
if (! empty($data['grapesjs']) && $data['grapesjs']) {
$isProposal = true;
$uploaded = $data['files'][0];
} else {
$isProposal = false;
$uploaded = $data['file'];
}
$extension = strtolower($uploaded->getClientOriginalExtension());
pats721
October 27, 2020, 7:06pm
29
Good news! Visual Studio Code was the issue. The command line worked. I am seeing the document attached to the invoice. I am going to start implementing this into my app and let you know if I run into any further issues.
Thank you for your help.
1 Like