How to convert Microsoft Word Document to PDF with Aspose.Word REST API throws 403 erorr

Checking out the Aspose Cloud at the moment using the trial and having issues attempting to convert a Word document to a PDF using the REST API.

Using a REST test client with the call below and attaching a docx file to the request, but getting a 403 Forbidden request. I’ve created my App in the cloud portal and the App SID and App Key are correct in the request. Is anyone able to tell me what I’m missing in my request?

https://api.aspose.cloud/v1/words/convert?appsid=222e8e09-0c9d-42fa-98b4-233a653af97b&appkey=xxxxxxxxxxxxx&format=PDF

Cheers
Cliff

Dear Cliff,

Thank you for contacting Aspose Support.

It appears you are not signing the URL incorrectly. The format for the resource URL is usually http://api.aspose.cloud/v1.1/words/{resource-url}?appSid={apps-id}&signature={signiture}. I have attached a sample JAVA application as an example as to how to do so URLGeneratorExample.java.zip (1.2 KB).

To convert a Word document to PDF you can use the following example

curl -v "http://api.aspose.com/v1.1/words/SampleWordDocument.docx?format=pdf&appSid=XXXX&signature=XXX" \
     -X GET \
     -H "Content-Type: application/json"

You can read more about the various means for converting from Word to other formats in out Converting a Document developer guide page.

Thank You.

Mateen Sajjad

@CliffKGibson

Please note since Aspose.Words Cloud 19.4, API request authentication methods OAuth2 and URL signing are obsolete. Now we use JSON Web Token(JWT) for API request authentication. Please check sample cURL commands for DOCX/DOC to PDF conversion using JWT access token.

# First get Access Token
# Get Client ID and Secret from https://dashboard.aspose.cloud/

curl -X POST "https://api.aspose.cloud/connect/token" 
-d "grant_type=client_credentials&client_id=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxx" 
-H "Content-Type: application/x-www-form-urlencoded" 
-H "Accept: application/json"

# cURL example to convert MS Word Document to PDF
curl -v "https://api.aspose.cloud/v4.0/words/convert?format=pdf" 
-X PUT 
-F document=@TableDocument.doc 
-H "Content-Type: multipart/form-data" 
-H "Accept: multipart/form-data" 
-H "Authorization: Bearer <jwt token>" 
-o TableDocument.pdf