I am testing an API to convert html page to a PDF. I have set up an API Action according to documentation available from the API developer and it’s authorising the API call correctly. However, I am getting this error when calling/loading the API Action with url of the page I want to convert.
POST 405 Method Not Allowed
This is the error I am getting when I look under Network Tab in the DevTools:
405 - HTTP verb used to access this page is not allowed. The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
The code for API Action is (some details have been changed):
Hi @patrick, thanks for sending information on this issue.
I tried both methods - Base64 encoded authorisation and prepending the url with username:password; I am still getting the POST 405 (Method Not Allowed) error.
It doesn’t seem to be an issue with the authorisation step, the error is happening when a POST call is made to the PDF conversion API along with the url to convert.
Edit: It looks like the error is coming from the IIS web server where the website (url for conversion) is hosted. This is coming up in the dev tools:
1. Request Method: POST 2. Status Code: 405 Method Not Allowed 3. Remote Address: xxx.xx.xxx.xxx:443 4. Referrer Policy: no-referrer-when-downgrade
After changing the code, I have started getting the CORS error.
I think the reason I’m getting the CORS error is because the url I’m sending to API for PDF conversion contains dynamically generated 'product_id=xxx.xxx` as query parameter, hence making it different from the main domain url.
I have added access-control-allow-origin: * but it’s not fixing the CORS issue.
I have resolved issues with the authorisation and CORS for the api call. However, after various attempts to get it working, it seems the API Action call is not picking up any Data that has been entered under the INPUT DATA API Action Properties.
As I am converting a web page to PDF, I’m adding URL of the source web page under INPUT DATA properties. But when I call the API, this URL is not being added to the api URL, resulting in an invalid POST api call.
In the code below, the API Call is not loading the dmx-data:url="" Input Data correctly.
But Input Data API Action Property (url=https://xyz.xyz.com.au/index.html) is not correctly being appended to the Request URL when making the POST call.
I have checked the Network Tab in Dev Tools and Request URL is not including the source URL for conversion.
Have I entered the source URL for PDF conversion in a wrong field?