I'm trying to make a post with google Apps.
function makePost(url,page,status,token) {
var form = {
"page" : 1,
"statuses[]": status.toString().toLowerCase(),
}
var options = {
'method': 'post',
'headers' : {"Authorization" : "BASIC "+token},
'contentType': 'application/x-www-form-urlencoded',
'payload' : form,
};
var response = UrlFetchApp.fetch(url, options);
var jsonResponse = JSON.parse(response.getContentText());
return jsonResponse;}
The problem seems to be that page is being past as 1.0 what makes the destination url return an error when tries to cast.
Already tried the answer in How to convert a string to number using Google Apps Script .
I cant pass it as a String , because in that case the API returns the result with an strange behaviour.
Is it possible to pass this as Integer without being change it to 1.0 ?
Any suggestion or help will be helpfull, thanks
UPDATE: So , i couldnt find a way to accomplish this. UrlFetchApp changes it every time. Lucky for me we could solve it by order the response in the API , and the behaviour passing a string stoped being erratic.
Thanks for the help and suggestions!