I have a problem with my script when I request a post it's always returned "Invalid Arguments". I don't know if my json parameters causing the problem. Please help me.
function getWallet() {
var header = {
"contentType": "application/json",
"headers":{ "Authorization": "xxxxxxxxx",
}
};
var dataRequestPost = {
"amount": 5.95,
"email": {
"recipient_email": "customer@acme.com",
"subject": "Rebate has arrived",
"message": "Thank you for using our service."
},
"ref": {
"order_id": "string",
"email": "string",
"id1": "string",
"id2": "string",
"phone_number": "string"
},
"add_to_blacklist": false
};
var rUrl = encodeURI('https://data.seller.tools/api/v1/wallet/paypal/USD');
var executeRequest = {
'url': rUrl,
'method' : 'post',
'payload' : dataRequestPost
};
var response = UrlFetchApp.fetch(executeRequest,header);
var object = JSON.parse(response.getContentText());
Logger.log(object);
}
question from:https://stackoverflow.com/questions/66066565/invalid-argument-in-urlfetchapp-fetch