Skip to main content
Question

REST API Failed Callback Function Information


Forum|alt.badge.img+6

Hello,

 

I have implemented a REST call and in general it works or fails as expected. However, when it fails (e.g. POST request) it triggers the "failed callback function”:

   Plsql_Rest_Sender_API.Call_Rest_EndPoint2(rest_service_        => rest_service_,
                                             xml_                 => json_,
                                             url_params_          => url_,
                                             callback_func_       => callback_func_,
                                             http_method_         => http_method_.action,
                                             --http_req_headers_    => ,
                                             --query_parameters_    => ,
                                             --header_params_       => ,
                                             incld_resp_info_     => true,
                                             --fnd_user_            => Fnd_Session_API.Get_Fnd_User,
                                             --key_ref_             => key_ref_,
                                             sender_              => rest_sender_,
                                             --http_req_headers_    =>'Content-Type:application/json',
                                             --receiver_            => ,
                                             --message_type_        => ,
                                             subject_             => subject_,
                                             --in_order_            => ,
                                             fail_notify_         => TRUE,
                                             failed_callback_fun_ => 'C_Webshop_Utility_Api.Rest_Fail_Callback'

                                             --accepted_res_codes_  => ,
                                             --auth_params_         => null
                                             );

 

The receiving function:

PROCEDURE Rest_Fail_Callback(error_text_ IN VARCHAR2, app_msg_id_ IN VARCHAR2)
IS
   
BEGIN   
   Dbms_Output.Put_Line('App msg id is : ' || app_msg_id_ );
   INSERT INTO flestephs(ts,msg_id,daten,response_code, headers) VALUES(sysdate, app_msg_id_, null,'ERROR',error_text_);
   @ApproveTransactionStatement(2023-10-02,StephanSeidl)
   commit;   
END Rest_Fail_Callback;

 

When the POST request fails, there is a backgroundjob created that calls that function and it contains the “Error”:

The state of the Application Message is “failed”

The Problem is, that the Error is just the response code and no detail. If I want to see details I have to include the response code into my SENDER:

After triggering my REST API again, the response will be processed as OK and the Application Message status will be “finished” and not “failed” but in the response I get detailed error list:

 

400#512#{"status":"error","data":[{"errors":[{"path":"\/ShowPriceSinglePrintVersion","message":"The data (null) must match the type: boolean (\/ShowPriceSinglePrintVersion)"},{"path":"\/NoHandlingSurcharge","message":"The data (null) must match the type: boolean (\/NoHandlingSurcharge)"},{"path":"\/PreferredPaymentType","message":"The data (null) must match the type: integer (\/PreferredPaymentType)"},{"path":"\/ParentCustomer","message":"The data (string) must match the type: integer, null (\/ParentCustomer)"}]}]}Transfer-Encoding:chunked
X-Cache:MISS
Server:nginx
X-Content-Type-Options:nosniff
Connection:keep-alive
Date:Wed, 04 Oct 2023 06:02:16 GMT
Referrer-Policy:strict-origin-when-cross-origin
Strict-Transport-Security:max-age=31536000
Cache-Control:max-age=0, no-store, no-cache, post-check=0, pre-check=0, must-revalidate
Vary:Accept-Encoding
Set-Cookie:tk-is-user-logged-in=1; path=/; domain=ifs.www.dev.com; secure
Expires:Tue, 04 Oct 2022 06:02:16
Content-Language:de
Age:0
Content-Type:application/json; charset=utf8

 

How can I configure my REST connection to fail, but also include the error details?

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings