I am trying to send encoded params as encoded uri component please view the code below:
params= {"requester":{"first_name": "hello@abc.com","email_id": "hello@abc.com", "login_user":"true"}};
encodedpURL=encodeURIComponent(url+'?'+params);
console.log(encodedpURL);
const response = UrlFetchApp.fetch(encodedpURL, options);
The encodedURIComponent converts the url as
https%3A%2F%2Fhelpdesk.com%2Fapp%2Fitdesk%2Fapi%2Fv3%2Frequesters%3F%5Bobject%20Object%5D
The Use Case
Send encoded query params to post data through API.
Query Params: Key = input_data, Value =
{"requester":{"first_name": "hello@abc.com","email_id": "hello@abc.com", "login_user":"true"}}The Value must be sent as Encoded URI Component.
API Call
var url = "https://helpdesk.com/app/itdesk/api/v3/requesters"; var options = { "method": "post", "headers": { "contentType": "application/x-www-form-urlencoded", "Accept": "application/vnd.manageengine.sdp.v3+json", "Authorization": "Zoho-oauthtoken "+apisheet[1][0] }, "muteHttpExceptions": true };`
Any reference of help will be highly appreciated. Thanks