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_rest_request with oauth_authenticate

All - trying to validate the correct syntax for apex_web_service.make_rest_request. I know that oauth_authenticate works (returns token). API request works in Postman. (know the REST URL, etc. is working)..
Not clear how I should be configuring the Make_REST_Request parameters. As I understand the apex_web_service.g_request_headers sets appropriate headers and the make_rest_request does not need to have a parameter...
Environment - APEX 22.2.1 / ADW. SQL Workshop.
apex_web_service.make_rest_request returns the following error -
ORA-29273: HTTP request failed
ORA-06512: at "APEX_220200.WWV_FLOW_WEB_SERVICES", line 1230
ORA-06512: at "SYS.UTL_HTTP", line 1378
ORA-29263: HTTP protocol error
ORA-06512: at "SYS.UTL_HTTP", line 712
ORA-06512: at "SYS.UTL_HTTP", line 1368
ORA-06512: at "APEX_220200.WWV_FLOW_WEB_SERVICES", line 1220
ORA-06512: at "APEX_220200.WWV_FLOW_WEB_SERVICES", line 1419
ORA-06512: at "APEX_220200.WWV_FLOW_WEBSERVICES_API", line 568
ORA-06512: at line 31
ORA-06512: at "SYS.DBMS_SQL", line 1721

declare
l_clob clob;
l_payload clob := '{
"cycleName": "Adhoc",
"flowName":"Adhoc",
"processName":"xxx_ADHOC",
"requestParameters":"xxx789"}';
begin
apex_web_service.oauth_authenticate(
p_token_url => 'https://idcs-xxx/v1/token',
p_client_id => 'xxx_APPID',
p_client_secret => 'xxx2658d',
p_scope => 'xxx99' );
apex_web_service.g_request_headers(1).name := 'Authorization';
apex_web_service.g_request_headers(1).value := 'Bearer ' || apex_web_service.oauth_get_last_token;
apex_web_service.g_request_headers(2).name := 'Content-Type';
apex_web_service.g_request_headers(2).value := 'application/json';
apex_web_service.g_request_headers(3).name := 'Accept-version';
apex_web_service.g_request_headers(3).value := '16.0';

l_clob := apex_web_service.make_rest_request (
p_url => 'https://xxxx/execution',
p_http_method => 'GET',
p_body => l_payload);

dbms_output.put_line('Here is the API call result -> '||l_clob);

end;

This post has been answered by Davidc12704-Oracle on Dec 26 2022
Jump to Answer
Comments
Post Details
Added on Dec 24 2022
3 comments
3,452 views