I am using below codes but it gives too many request error some time and some time works perfectly. I need to send request to the server more than 5 times in a day.
DECLARE
l_param_list VARCHAR2(512);
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
l_content VARCHAR2(32767);
l_response_text VARCHAR2(32767);
l_buffer VARCHAR2(32767);
l_response_body CLOB := NULL;
l_req_context utl_http.request_context_key;
l_eob BOOLEAN := false; -- END-OF-BODY flag (Boolean)
l_url VARCHAR2(4000);
BEGIN
l_url := 'https://abc.com';
l_req_context := utl_http.create_request_context(wallet_path => 'wallet location', wallet_password => 'wallet password');
l_http_request := UTL_HTTP.begin_request (l_url,'GET','HTTP/1.1',l_req_context);
utl_http.set_header(l_http_request, 'Authorization', 'Bearer toekn');
l_http_response := UTL_HTTP.get_response(l_http_request);
dbms_lob.createtemporary(l_response_body, true);
WHILE NOT(l_eob)
LOOP --reponse reading loop
BEGIN
UTL_HTTP.read_text(l_http_response, l_buffer, 32767);
if l_buffer is not null and length(l_buffer)>0 then
--appned data in clob column
dbms_lob.writeappend(l_response_body, length(l_buffer), l_buffer);
end if;
EXCEPTION
WHEN UTL_HTTP.end_of_body THEN
l_eob := true;
END;
END LOOP;--reponse reading loop
dbms_lob.freetemporary(l_response_body);
UTL_HTTP.end_response(l_http_response);
UTL_HTTP.DESTROY_REQUEST_CONTEXT(l_req_context);
EXCEPTION
WHEN UTL_HTTP.TOO_MANY_REQUESTS THEN
DBMS_OUTPUT.put_line (sqlerrm);
UTL_HTTP.DESTROY_REQUEST_CONTEXT(l_req_context);
UTL_HTTP.END_RESPONSE(l_http_response);
WHEN OTHERS THEN
NULL;
END;
Regards