I use Oracle Apex 19 and need to make a procedure to send mail using Mailgun rest API.
if I write on console the next curl code it work fine:
curl --location --request POST 'https://api.mailgun.net/v3/example.com.ar/messages' \
--header 'Authorization: Basic <<my-secrect-api-code>>' \
--form '[email protected]' \
--form '[email protected]' \
--form 'subject=Test' \
--form 'template=mytemplatename'
In postman also work correctly:
How I said, I need translate this code to APEX PL/SQL , I tried
declare
-- Local variables here
i integer;
l_resp clob;
g_url varchar2(300) := 'https://api.mailgun.net/v3/example.com.ar/messages';
begin
-- Test statements here
apex_web_service.g_request_headers(1).name := 'Authorization';
apex_web_service.g_request_headers(1).Value := 'Basic my-secret-code';
l_resp := apex_web_service.make_rest_request(p_url => g_url,
p_http_method => 'POST',
p_parm_name => apex_util.string_to_table('from:to:subject:template',':'),
p_parm_value => apex_util.string_to_table('[email protected]:[email protected]:helo:mytemplate',':'),
p_wallet_path =>'file:/backup/wallet',
p_wallet_pwd => null);
dbms_output.put_line(L_resp);
end;
when call the pl/sql procedure I allways get the error:
{
"message": "'from' parameter is missing"
}
It sound like FORM parameters is not send, but I dont know how to make this request with APEX_WEB_SERVICE.
Can you help me?
