Connect Salesforce REST API Using JavaScript
const requestData = { 'transId' : 'NEFT0123456789' , 'transAmount' : 20500.50 , 'transDate' : '25/10/2022' , 'transRemark' : 'M400 Payment message' , }; const tokenURL = 'https://XXXXXXX.sandbox.my.salesforce.com/services/oauth2/token' ; const payloadURL = 'https://XXXXXXX.sandbox.my.salesforce.com/services/apexrest/M400_SFReceiver' ; const grant_type = 'password' ; const client_id = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ; const client_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ; const username = 'XXXXXXXXXXXXXXXXXXXXXXXXXX' ; const password = 'XXXXXXXXXXXXXXXXXXXXX' ; fetch ( tokenURL + '?grant_type=' + grant_type + '&client_id=' + client_id + '&client_secret=' + client_secret + '&username=' + username + '&password=' + password , { method : 'POS