I have my APEX environment (22.2) on OCI.
I have this simple test procedure to write a file to an OCI bucket, and then read the file.
DECLARE
l_blob blob;
l_bucket_url varchar2(200) := 'https://idxxxxxxxwp.objectstorage.us-ashburn-1.oci.customer-oci.com/n/idxxxxxxwp/b/pdfgenerator/o/';
l_json clob;
l_response clob;
BEGIN
l_json := '{"data": {"first_name": "Johan","last_name": "Gambolputty","job": "Comedian","company": "Acme"}}';
apex_web_service.g_request_headers(1).name := 'Content-Type';
apex_web_service.g_request_headers(1).value := 'application/json';
l_response := apex_web_service.make_rest_request(p_url => l_bucket_url ||'my_test.json'
,p_http_method => 'PUT'
,p_body_blob => APEX_UTIL.CLOB_TO_BLOB(p_clob => l_json)
,p_credential_static_id => 'FN_CREDENTIALS');
l_blob := apex_web_service.make_rest_request_b(p_url => l_bucket_url ||'my_test.json'
,p_http_method => 'GET'
,p_credential_static_id => 'FN_CREDENTIALS');
END;
I can see that the file is created, but reading it returns an error:
HTTP response 404 - Not Found
body: {"code":"BucketNotFound","message":"Either the bucket named 'pdfgenerator' does not exist in the namespace 'idoxxxxxxwp' or you are not authorized to access it"}
This is basically copy-paste from code you find in several blogs, like this one. Only my case returns this error :-(
Any idea where I can look?
Note: the URL is a newer version for accessing buckets. I got this message on OCI:
The current URL is deprecated and will no longer be supported in a future release of the console. A new URL will be used as shown below
Where the “current URL” is what you see in all blogs:
https://objectstorage.us-ashburn-1.oraclecloud.com/ …..