Last active
March 27, 2017 16:55
-
-
Save ibek/22f0c7c655bf31b06f728ce1fe0df7ad to your computer and use it in GitHub Desktop.
Google Forms Apps Script to do REST request
This file contains hidden or 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