HTTP call to Cloud API via Power Automate to Append Word Document

Aspose Team, we’re looking to start using Aspose APIs heavily in our Microsoft Power Automate tasks for clients. I’ve managed to work out how to get and apply the Bearer Token fine as below in image.png (working). I’ve setup a default blob storage location and have 3 test documents in there.

image.png (85.7 KB)

I’m now trying to test your append function to join two DOCX files together, but am having no luck. I’ve tried via Power Automation HTTP function and Postman with no success. I’ve attempted using
https://api.aspose.cloud/v4.0/words/TEST_DOC1.docx/appendDocument, and https://api.aspose.cloud/v4.0/words/online/put/appendDocument but can’t seem to make this work. I keep getting: Error: AppendDocument. Exception: List of appending entries should contain at least 1 entry… which means my document list is not being uploaded correctly.

Ideally I’d like to send the file contents in the api call, rather than upload each docx into storage and then reference it, but Id be happy to get any method working at this stage. Can you please assist? Perhaps provide some guidance as the document and sample code is not helping.

Thanks,
Rob

@rmarathakis

Please check the following sample cURL command to append multiple Word documents. Hopefully, it will help you accomplish the task.

curl -X PUT "https://api.aspose.cloud/v4.0/words/02_pages.docx/appendDocument?destFileName=AppendcURL.docx" 
-H "accept: application/json" 
-H "Authorization: Bearer eyJhbG.....hN6BhrWQ" 
-H "Content-Type: application/json" 
-d "{"DocumentEntries":[{"Href":"Aspose.docx","ImportFormatMode":"KeepSourceFormatting"},{"Href":"Document1.docx","ImportFormatMode":"KeepSourceFormatting"}],"ApplyBaseDocumentHeadersAndFootersToAppendingDocuments":true}"

@tilal.ahmad Thankyou! I’ve realised I was calling POST instead of PUT. Your example was very helpful.

1 Like