API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Order_GetPdf returns null...

0

When I upgrade a Quotation to an order, I want to save the PDF using the API.

I can see that the quotation are made into an order and I get a response back, with the orderid.

 

$client = __connect();
$response = $client->Quotation_UpgradeToOrder(array("quotationHandle"=>array("Id"=>$quoteid)))->Quotation_UpgradeToOrderResult;
$orderid = $response->Id;p($orderid);
// Vi skal hente PDF filen...
$filename = "Ordre_". $tilbudnr .".pdf";
$pdf = $client->Order_GetPdf(array("orderHandle"=>$response))->Quotation_GetPdfResult;
file_put_contents( __DIR__ ."/../pdffiles/".$filename, $pdf );
 
But the saved file is 0 bytes - contains nothing. When I debug I can see that $response holds a valid result :
stdClass Object ( [Id] => 286 )
 
Any one got a clue ??
created Nov 18, 2013 by internetservice
67% Accept Rate
Q 7 A 2 C 5

1 Answer

0
 
Best answer

Sorry guys - this was yet another fejl 40 ;)

See the code below - obviously I need to use the API correct, so when I use ORDER getpdf - it's no use to try to retrieve QUOTATION_getpdfresult...

$pdf = $client->Order_GetPdf(array("orderHandle"=>$response))->Quotation_GetPdfResult;
 
So the correct - and working code - are here :
$client = __connect();
$response = $client->Quotation_UpgradeToOrder(array("quotationHandle"=>array("Id"=>$quoteid)))->Quotation_UpgradeToOrderResult;
$orderid = $response->Id;p($orderid);
// Vi skal hente PDF filen...
$filename = "Ordre_". $tilbudnr .".pdf";
$pdf = $client->Order_GetPdf(array("orderHandle"=>$response))->Order_GetPdfResult;
file_put_contents( __DIR__ ."/../pdffiles/".$filename, $pdf );

 

answered Nov 19, 2013 by internetservice
Visma e-conomic A/S
...