I am trying to send data through HTTP POST from an Excel/VBA script to an API I built in Google Apps script. The Google script executes correctly, but always returns a 405 "Method not allowed" and the return value is an HTML page from Google Drive. When I send the same POST from Postman, I get status 200 and the return value is he one that is implemented in the Google script.
The Google apps minimal test script that I used:
function doPost(e) {
return ContentService.createTextOutput("Gelukt").setMimeType(MimeType.JSON);
}
The relevant code in VBA:
With objHTTP
.Open "POST", Url, False
.setRequestHeader "Content-Type", "text/plain"
.setRequestHeader "Accept-Language", "en-US"
.send JsonString
End With
When I send the POST request to webhook.site it shows this:
I tried all suggestions I could find, but nothing changes the 405!