PDF to HTML REST API conversion via cURL

My query refers to the cURL example on Convert PDF to Other File Formats|Documentation

I am trying to use the cURL for Aspose .PDF REST API to convert a PDF to HTML and download the HTML output as a ZIP file. Unfortunately, although I get the authentication token in the first step, I get a failure message when I try to use the token to access the conversion to HTML API.

The failure message is

{“Message”:“Authentication failed!”}

See the pdfs below showing the PHP code (code 2 doc.pdf) I use and its output (code 1 doc.pdf)

code 1 doc.pdf (412.2 KB)

code 2 doc.pdf (226.0 KB)

Can someone please help me with this issue?

Thanks,
Pratyush
code 2 doc.pdf (226 KB)
code 1 doc.pdf (412 KB)

@debp85

We are sorry for your inconvenience. Please note you need to use base URI https://api.aspose.cloud/v3.0 instead of https://api.aspose.cloud/v1.1. It will resolve the issue. We are also in process of updating the documentation for new API Version.

Yes that solved the issue.

Thanks,
Pratyush

1 Like

I am using same base URL
Below is my URL with both the key
https://api.aspose.cloud/v3.0/viewer/editor/home/trupti/Downloads/030420231680538753.pdf?appSID=b3c87422-834d-44sa-b809-32556b85d4b6&appKey=ece9e096dc4d7e90aa3cd0316fssa7d

I am still facing issue, please help me

@debp85

Please share your complete code, we will look into it and guide you accordingly.

Screenshot from 2023-07-21 16-51-48.png (170.3 KB)
please check above attachment,
I am trying to execute API from postman but still this not working
if possible can you please provide me sample client id and key?

@truptilad

Please note that you need to pass the JSON Web Token(JWT) to authenticate the API request. Kindly check the sample cURL commands along with the Postman screenshot for details. Hopefully, it will help you accomplish the task.

JSON Web Token(JWT)

# First get Access Token
# Get Customer Key and Customer ID from https://dashboard.aspose.cloud/
curl -X POST "https://api.aspose.cloud/connect/token" 
-d "grant_type=client_credentials&client_id=xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx&client_secret=xxxxxxxxxxxxxxxxx" 
-H "Content-Type: application/x-www-form-urlencoded" 
-H "Accept: application/json"

Convert PDF file from cloud storage to HTML and save output to cloud storage

# Convert PDF to HTML
curl -X PUT "https://api.aspose.cloud/v3.0/pdf/02_pages.pdf/convert/html?outPath=result.zip&outputFormat=Zip" 
-H "accept: application/json" 
-H "authorization: Bearer eyJhbGciOiJSUzI1.....MGuEuQOSwcSEOZEaBw"