{ "error" : { "time" : "2019-05-24T12:25:13.059829Z", "code" : 404, "description" : "Not Found" }}
//Updating flow by adding new default pathsfunction addDefaultPathsIntoFlow() { try{ //Reading sheet to get required details to add default paths. var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheetByName("Flow Editor"); //Gives no of rows to consider while fetching range from sheet var no_of_row = ss.getSheetByName("Raw Data Pull").getRange("K3:K3").getValue(); var dataRange = sheet.getRange(4,1,no_of_row,7).getValues(); //Each iteration makes one API Call to Voluum for(var i=0; i < dataRange.length; i++){ //default path contains the array of objects, each object represent one default path in flow var new_default_path_obj = { "name" : "", //Required "active" : "true", "weight" : "100", "offers" : [], //Required, contains offer object, defined below "landers" : [], //Required, contains lander object, defined below "offerRedirectMode" : "REGULAR", "realtimeRoutingApiState": "DISABLED" } var row = dataRange[i]; var flow_id = row[1]; var default_name = row[2]; var offer_id = row[6]; var lander_id = row[4]; //assigning the path name new_default_path_obj.name = default_name; //Gettin flow object var flow_response = config.apiCall(config.endpoints.flow, flow_id,'get'); //I have config object in one .gs file where it contains apiCall() method to GET voluum details
flow_response = JSON.parse(flow_response); var default_paths_array = flow_response.defaultPaths; //Push into new_default_path_obj.landers.push(); var lander_object = { "lander": { "id":lander_id, }, "weight":100 }; //Push into new_default_path_obj.offers.push(); var offer_object = { "offer": { "id" : offer_id, }, "weight":100 }; //Create new object new_default_path_obj.name = default_name; new_default_path_obj.offers.push(offer_object); new_default_path_obj.landers.push(lander_object); //Put new object default_paths_array.push(new_default_path_obj); console.log(flow_response); //Prints the final object with newly added default path object in default paths array var scriptProperties = PropertiesService.getScriptProperties(); var options = { 'method' : 'put', 'headers': { 'contentType' : 'application/json', 'cwauth-token': scriptProperties.getProperty("token"), //getting token required for making request to Voluum 'Accept' : 'application/json' }, 'muteHttpExceptions' : true, 'payload' : flow_response //I tried using JSON.stringify(flow_response) as well }; var x = UrlFetchApp.fetch("https://api.voluum.com/flow/f660d3xxxxxxxxxxx04", options); console.log(x); //This is giving me "Not Found" Error msg.
}
}catch(e){ GmailApp.sendEmail("siddhesh...@gmail.com", "Error",e) }
}
![]() |
Sender notified by Mailtrack 05/26/19, 3:26:11 PM |
So you are using the properties service, have you tried without? That worked for me
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/58e31435-8832-44e0-9358-4e2692405d9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAHGG7fzaGeVinGCr3nqbYqA%3DYNS22rnVNJ96F9r6zP-gP%3DOA_w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAEZbQn9HdujerE3-xV7BpRVu3nmLMryniw9pEAPE60rwkyAZxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
function myFunction() { var options = { 'method' : 'PUT', 'headers': { 'contentType' : 'application/json', 'cwauth-token': 'A_TOKEN_HERE', //getting token required for making request to Voluum
'Accept' : 'application/json' }, 'muteHttpExceptions' : true,
'payload' : {foo:'bar'} //I tried using JSON.stringify(flow_response) as well }; var resp = JSON.parse(UrlFetchApp.fetch("https://postman-echo.com/put", options).getContentText());}
Here is the code
On Friday, May 24, 2019 at 7:42:51 PM UTC+5:30, Eric Koleda wrote:I don't think we'll be able to provide much help without at least seeing some code. Perhaps you could remove the sensitive bits and post some of it?- Eric
On Friday, May 24, 2019 at 8:29:13 AM UTC-4, sidmish wrote:Hello all, as due to previously having questions mark as need editing on stackoverflow, so i couldn't able to post their. Hence i came here.
I am connecting the Voluum flow API using GAS.
I've been able to get the details from Voluum using "GET" method but now this time i have to make some changes ( using "PUT" method ) into their existing flow using flow_id.
I am able to achieve the same using POSTMAN but unable to do that same here using GAS.Code/Logic is bit confidential so i can't write here, but i want someone to help me out with this by personally contacting or screen sharing.It is very strange behavior from GAS side, i am writing down the below scenario which make more sense,
Step 1: First i am calling Voluum API using GET method to get the flow obj.Step 2: Now i am parsing the flow response using JSON.parse, so that i can push new object in default array which exist in flow responseStep 3: I am calling Voluum API with update flow response object using PUT method, but i am getting following error
{"error" : {"time" : "2019-05-24T12:25:13.059829Z","code" : 404,"description" : "Not Found"}}
But here is a catch, when i am skipping step 2, that is if i am getting flow response as it is from GET method and directly putting it to payload for PUT method, then i am not getting any error and its successful call.What could be the possible hack/or i am missing something?Please do let me know. I am stuck on it since 3 days.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/58e31435-8832-44e0-9358-4e2692405d9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Siddhesh Mishra--Siddhesh Mishra--Siddhesh Mishra
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAHGG7fzaGeVinGCr3nqbYqA%3DYNS22rnVNJ96F9r6zP-gP%3DOA_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAEZbQn9HdujerE3-xV7BpRVu3nmLMryniw9pEAPE60rwkyAZxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--Siddhesh Mishra
Here is the code
On Friday, May 24, 2019 at 7:42:51 PM UTC+5:30, Eric Koleda wrote:I don't think we'll be able to provide much help without at least seeing some code. Perhaps you could remove the sensitive bits and post some of it?- Eric
On Friday, May 24, 2019 at 8:29:13 AM UTC-4, sidmish wrote:Hello all, as due to previously having questions mark as need editing on stackoverflow, so i couldn't able to post their. Hence i came here.
I am connecting the Voluum flow API using GAS.
I've been able to get the details from Voluum using "GET" method but now this time i have to make some changes ( using "PUT" method ) into their existing flow using flow_id.
I am able to achieve the same using POSTMAN but unable to do that same here using GAS.Code/Logic is bit confidential so i can't write here, but i want someone to help me out with this by personally contacting or screen sharing.It is very strange behavior from GAS side, i am writing down the below scenario which make more sense,
Step 1: First i am calling Voluum API using GET method to get the flow obj.Step 2: Now i am parsing the flow response using JSON.parse, so that i can push new object in default array which exist in flow responseStep 3: I am calling Voluum API with update flow response object using PUT method, but i am getting following error
{"error" : {"time" : "2019-05-24T12:25:13.059829Z","code" : 404,"description" : "Not Found"}}
But here is a catch, when i am skipping step 2, that is if i am getting flow response as it is from GET method and directly putting it to payload for PUT method, then i am not getting any error and its successful call.What could be the possible hack/or i am missing something?Please do let me know. I am stuck on it since 3 days.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/58e31435-8832-44e0-9358-4e2692405d9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Siddhesh Mishra--Siddhesh Mishra--Siddhesh Mishra
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAHGG7fzaGeVinGCr3nqbYqA%3DYNS22rnVNJ96F9r6zP-gP%3DOA_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAEZbQn9HdujerE3-xV7BpRVu3nmLMryniw9pEAPE60rwkyAZxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
----Siddhesh Mishra
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/deb0ef15-3aed-4212-9841-6da84146d03f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAHGG7fxSpEUMa9npsC8RbFKuU%3D6YjrwACe7v%3DUur8PSi4jeorA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Adam Morris | IT Systems & English Teacher | IGB International School
Jalan Sierramas Utama, Sierramas,
47000 Sungai Buloh, Selangor DE, Malaysia
t +60 3 6145 4688
f +60 3 6145 4600
w www.igbis.edu.my
e adam....@igbis.edu.my
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAFgZO_OELZKZuEE4S1zdUqq%2B4drAoGuhkX7tyHCH_sMceB8Xjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Adam Morris | IT Systems & English Teacher | IGB International School
Jalan Sierramas Utama, Sierramas,
47000 Sungai Buloh, Selangor DE, Malaysia
t +60 3 6145 4688
f +60 3 6145 4600
w www.igbis.edu.my
e adam....@igbis.edu.my
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAHGG7fxvE94ZTKhmTzXwpzmyYyxpUfneBasBASgC405%2Bw6PWRw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAFgZO_NuSCWeMZ8x_SDZWkzG2AO6Z7hU155WqY2PbmJps2o2VA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAHGG7fz2rv%2B2L752G5bf%2Brm58T-1msfbW1rWJ7Xr5ON7kFM8VA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAHjvmF4wpBD3BqBSaYoz91tWpfv9sZjr4GZV1CxFkFDvDW0hqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.