Hello All,
We have a requirement to make a POST call from apex to salesforce token generation (oauth2) url (https://test.salesforce.com/services/oauth2/token) to get the bearer token as response and use that bearer token to make GET call to service endpoint url (https://companyapps--devinsec.cs24.my.salesforce.com/services/data/v47.0/queryAll)
For the first POST call, we need to pass Five parameters (username, password, client_id, client_secret and grant_type) in body request.
We have tried like below, but it did not worked. Could you guys please help me ??
declare
token CLOB;
begin
token := apex_web_service.make_rest_request(
p_url => 'https://test.salesforce.com/services/oauth2/token',
p_http_method => 'POST',
p_parm_name => apex_util.string_to_table('username:password:client_id:client_secret:grant_type'),
p_parm_value => apex_util.string_to_table('gsb.oracleapi@company.edu:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:password'),
p_proxy_override => 'server.company.edu:8080',
p_wallet_path => 'file:/u01/app/oracle/wallet/');
dbms_output.put_line(token);
end;
/