I keep getting a "Moved Temporarily" (302 redirect) response when sending a basic curl command to a very simple doPost.
The project test is very simple - this is the entire Code.gs code:
function doPost(e) {
return ContentService.createTextOutput(JSON.stringify({ message: "Received" }))
.setMimeType(ContentService.MimeType.JSON);
}
I have tried creating both a personal and a workgroup Google account, both getting the same results.
I have tried it from a different network (home/personal).
The executions logs are not showing details - just that they have been "completed" without failing - but from the curl command side, a 302 is deadly.
I have set project settings with:
Execute as: Me
Who has access: Anyone
GCP Project: default
Here's the curl command I have used (with my id removed):
curl -X POST "
https://script.google.com/macros/s/[removedforsecurity]/exec?action=processData" -H "Content-Type: application/json" -d "{\"upcCode\":\"089036422802\"}"
I have also tried:
curl -X POST "
https://script.google.com/macros/s/
[removedforsecurity] /exec" -H "Content-Type: application/json" -d "{\"upcCode\":\"089036422802\"}"
curl response is:
<!-- GSE Default Error -->
<H1>Moved Temporarily</H1>
The Execution logs are no help either; they report as completed without failing, but they also do not allow me to click on them either. Even when I add a line: Logger.log("received") as the first line in the doPost.
Any thoughts as to how this can be resolved?
Thanks!