Reputation: 449
I have created a Google Sheet App Script and published as web app. https://script.google.com/macros/s/AKfycbyqUxINw93wmWPouXb7nOjt2886FBj6HBKg9sMF1B4rMN0I1xFG/exec
While i tried to POST data to this url, it's redirect to another URL. How i can avoid this redirection.?
Upvotes: 3
Views: 2081
Reputation: 449
Don't use ContentService. if you are using ContentService for returning JSON data. it will redirect to another URL. That's why your are getting 302 response.
return ContentService.createTextOutput(JSON.stringify(result))
.setMimeType(ContentService.MimeType.JSON);
https://developers.google.com/apps-script/guides/content#redirects
Upvotes: 4