-
-
Save hguerrero/0e5f38668ab0cce45cab5c6f000c796d to your computer and use it in GitHub Desktop.
Google Forms Apps Script to do REST request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function startProcess(e) { | |
var formResponse = e.response; | |
var itemResponses = formResponse.getItemResponses(); | |
var data = {}; | |
for (var j = 0; j < itemResponses.length; j++) { | |
var itemResponse = itemResponses[j]; | |
var title = itemResponse.getItem().getTitle(); | |
data[title] = itemResponse.getResponse(); | |
} | |
var options = { | |
'method' : 'post', | |
'contentType': 'application/json', | |
// Convert the JavaScript object to a JSON string. | |
'payload' : JSON.stringify(data) | |
}; | |
// start a process instance on KIE Server | |
UrlFetchApp.fetch('https://httpbin.org/post', options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment