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!

PL/SQL REST API call error (ORA-29273)

BlueForest85Mar 20 2023 — edited Mar 20 2023

Hello everyone,

Here is my https://apex.oracle.com/ account :
https://apex.oracle.com/pls/apex/
username : testuser
P : HiAPEXSharedForum12@^
Workspace : my_test_workspace

In the application called : REST API TEST
On the homepage, I added a button which calls a procedure, this procedure :

DECLARE
    v_req_url    VARCHAR2(4000);
    v_http_method    VARCHAR2(10);

    v_param_name    apex_application_global.vc_arr2;
    v_param_value   apex_application_global.vc_arr2;

    v_auth_scheme    VARCHAR2(10);
    v_auth_username       VARCHAR2(255);
    v_auth_password       VARCHAR2(255);

    v_req_result         CLOB;
    v_response       CLOB;
    v_response_http_status NUMBER;

    v_json_array     JSON_ARRAY_T;
    v_json_object    JSON_OBJECT_T;

    v_cca2 VARCHAR2(12);
    v_cca3 VARCHAR2(12);
BEGIN
    v_req_url := 'https://restcountries.com/v3.1/name/usa';
    v_http_method := 'GET';

    --PARAMS
    --v_param_name(1) := 'param1';
    --v_param_value(1) := 'value1';

    --v_param_name(2) := 'param2';
    --v_param_value(2) := 'value2';

    --AUTH IF NECESSARY
    -- v_auth_scheme := 'Basic'; -- or other appropriate authentication method (e.g., 'Bearer')
    -- v_auth_username := 'your_username';
    -- v_auth_password := 'your_password';

    --API CALL
    v_req_result := apex_web_service.make_rest_request(
        p_url => v_req_url,
        p_http_method => v_http_method
        --p_parm_name => v_param_name,
        --p_parm_value => v_param_value,
        --p_username    => v_auth_username,
        --p_password    => v_auth_password,
        --p_auth_scheme => v_auth_scheme
        );

    --HTTP STATUS
    v_response_http_status := apex_web_service.g_status_code;

    :P1_NEW := v_response_http_status;
END;

I set the http status in a text field item.

It works well, I get 200.

Now, I try the same on my localhost APEX instance, which version number is 22.1.0

I get the ORA-29273 error, and when I analyse the logs, I can see ORA-12545 : Connect failed because target host or object does not exist.

I think that might be an ACL configuration to set, but I'm not sure.

Can you help me ?

Thank you everyone

Comments
Post Details
Added on Mar 20 2023
9 comments
132 views