Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* This function is used to receive JSON information through an apikey, nonce and then a hmac sha512 signed message with an apisecret is send through a JSON POST request */
- function ImportJSONViaPost(url, payload, fetchOptions, query, parseOptions) {
- var postOptions = parseToObject_(fetchOptions);
- if (postOptions["method"] == null) {
- postOptions["method"] = "POST";
- }
- if (postOptions["payload"] == null) {
- postOptions["payload"] = payload;
- }
- if (postOptions["contentType"] == null) {
- postOptions["contentType"] = "application/x-www-form-urlencoded";
- }
- convertToBool_(postOptions, "validateHttpsCertificates");
- convertToBool_(postOptions, "useIntranet");
- convertToBool_(postOptions, "followRedirects");
- convertToBool_(postOptions, "muteHttpExceptions");
- return ImportJSONAdvanced(url, postOptions, query, parseOptions, includeXPath_, defaultTransform_);
- }
- function ImportJSONAdvanced(url, fetchOptions, query, parseOptions, includeFunc, transformFunc) {
- var jsondata = UrlFetchApp.fetch(url, fetchOptions);
- var object = JSON.parse(jsondata.getContentText());
- return parseJSONObject_(object, query, parseOptions, includeFunc, transformFunc);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement