Free Support Forum - aspose.cloud

Merge PowerPoint Presentation in PHP using Aspose.Slides REST API intermittently throws 400 Client error

Hi,

I fixed the problem.
I am now trying to use $slidesApi->mergeOnline.

My problem is this, on average every other time it works, and if it doesn’t it gives me an error like this:
[400] Client error: POST https://api.aspose.cloud/v3.0/slides/merge resulted in a 400 Bad Request, “error”:{“code”: “PresentationLoadFailed”, “message”: "Failed to load t (truncated…)

Any idea where this is coming from?

@lcar,
Thank you for your query. Could you share the code example reproducing the error, please?

$config = new Configuration();
$config->setAppSid(“xxx”);
$config->setAppKey(“xxx”);
$slidesApi = new SlidesApi(null, $config);

$filesToMerge = array();

foreach($files as $file) {

$filesToMerge[] = fopen($path, ‘r’);
}

$response = $slidesApi->mergeOnline($filesToMerge, null);

@lcar,
It will take me a while to investigate this case. Thank you for your patience.

@lcar

Can you please provide the presentation file that you are using on your end. The issue may likely be a big presentation giving a time out response is obtained or an issue with API itself while working with presentation. Can you please share the details so that we may verify it further.

@lcar

In addition to the above reply, we have tested the mergeOnline API with a number of different PPTX files but we are unable to reproduce the issue. So as requested above, please share your sample PPTX files to replicate the issue it may be related to your input PPTX files size or structure.

$files = array("C:/Temp/AccessSlides.pptx", "C:/Temp/test.pptx", "C:/Temp/Slide1.pptx");


$filesToMerge = array();

foreach($files as $file) {
$filesToMerge[] = fopen($file, 'r');
}

$response = $slidesApi->mergeOnline($filesToMerge);
copy($response->getPathName(),"MergeOnline.pptx");
print_r($response);
echo "Completed!!!!";