Reputation: 2198
I have a small piece of code, which retrieves all urls for attachments for an invoice
$salesInvoice = new \Picqer\Financials\Exact\SalesInvoice($connection);
$salesInvoices = $salesInvoice->filter("InvoiceToName eq 'my dude'");
$this->addTplParam("oItems", $salesInvoices);
$aInvoices = array();
$aDocuments = array();
$aDocumentAttachments = array();
// we collect all the invoices numbers
foreach($salesInvoices as $salesInvoice)
{
$aInvoices[] = $salesInvoice->InvoiceNumber;
}
// now we check the Documents
$document = new \Picqer\Financials\Exact\Document($connection);
$documents = $document->filter("SalesInvoiceNumber eq ".$aInvoices[0]);
foreach($documents as $document) {
$aDocuments[] = $document->ID;
}
// now the attachments
$documentAttachment = new \Picqer\Financials\Exact\DocumentAttachment($connection);
$documentAttachments = $documentAttachment->filter("Document eq guid'".$aDocuments[0]."'");
foreach($documentAttachments as $documentAttachment)
{
$aDocumentAttachments[] = $documentAttachment->Url;
}
Regardless if it is well-written or not, for not it fulfills the job. So, for instance, I get back something like this:
https://start.exactonline.de/docs/SysAttachment.aspx?ID=123123-123123-123123&Division=1234
When trying to access this document, I'm getting an error-msg that I have no access to view this document.
Now my question: Is it possible to create a PDF "on the fly" with this link? How can I proceed? It only works as long as I'm logged in to exact-online. Customer however doesn't have an account there.
Upvotes: 1
Views: 157
Reputation: 156
Each call to Exact Online needs to be authenticated. In this case you also need to specify the Authorization header with an access token. I think you want to show the invoices you made in Exact Online to your customers. For that to accomplish, use above specified method. Once you have retrieved the data, you can show it to your customer based on your own needs/criteria as you are the owner of the data. If you specify the business case, we can discuss this further. Or you can enter a ticket. (Disclaimer : I'm a Exact employee)
Upvotes: 0
Reputation: 157098
No, that is not possible. You can't circumvent the security of ExactOnline by just using the URL of the resource.
What you have to do is make it possible for your customers to get the document while authenticated in a safe manner. There is nothing out of the box to do this for you, so that would mean a lot of handwork for you I guess.
Upvotes: 2