Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

apex_web_service.make_request to salesforce

Rajesh MandalapuJun 10 2020 — edited Jun 15 2020

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;

/

This post has been answered by Veerendra Patil on Jun 14 2020
Jump to Answer
Comments
Post Details
Added on Jun 10 2020
9 comments
898 views