How to create a doPost(e) to receive data from an

2019-09-19 12:28发布

问题:

I'm trying to create a Script that receives data from a POST that I make from Postman, but every time I get the error code 301. I followed different tutorials (Google Web App and Stack Overflow posts) with not good results. I only need to receive the data from this POST call and send them to a SpreadSheet for their storage.

Thanks for your help, I really appreciate it.

回答1:

You need to make sure you're following redirects. In Postman, go to your preferences, and make sure you've enabled "Automatically follow redirects".

Alternatively, you can use Hurl.it, which has the redirects option very clearly visible.



回答2:

This link you have commented in one answer : https://script.google.com/macros/s/AKfycbzuXLBu9Rsq9R51xboIlTkTEqUTKyfJisRboeYkPKAUmp_OUw/exec

When I tried opening, it's asking me to Give permissions.

Which means MAYBE you're not "Executing the app as" yourself [me(your email)]. Rather you have selected something else like "User who is accessing"

So if you want to access it via Postman then you need to implement proper authentication or Execute it on your behalf.

Hope this helps you.