2

enter image description here

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.?

Eldhose Elias
  • 389
  • 1
  • 6
  • 22

1 Answers1

3

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

Eldhose Elias
  • 389
  • 1
  • 6
  • 22