Oracle APEX RESTFUL API, How to store data through API into table, POST API



1) Create table to store data :=

CREATE TABLE   DT_SIGNATURE2  

   ( ID  NUMBER, 

SIGNATURE_IMAGE  BLOB, 

MIMETYPE  VARCHAR2(100), 

DT_CRT_DATE  DATE DEFAULT sysdate, 

FILENAME  VARCHAR2(30), 

DT_MOD_DATE  DATE DEFAULT SYSDATE, 

CL_IMG  CLOB

  );


2) Create Module

Module Name(Value Required) := Any_Name

Base Path(Value Required) := /Any_Name/

Pagination Size(Value Required) := 1000


3) Create a Template

URI Template(Value Required) := Any_Name


4) Create a handler

Code :=

begin

insert into dt_signature (ID,CL_IMG,FILENAME) values(:id,:data,:cand_code);

 commit;

end;


Parameters:=

id         

data

cand_code


**********Postman Call Post API*****************



Post := https://apex.oracle.com/pls/apex/praticedemo/tech_probie/database/

Body := select raw<json

parameters:= {

"id":"321", "data":"52321", "cand_code":"rajat_rawat" }

                                                                                                                                                              

************Insert Data Through API using PL/SQL Prcoedure *********


create or replace PROCEDURE RESTFUL_IMAGE(id in varchar2,data in varchar2,cand_code in varchar2)

is

l_response_clob clob;

l_body      VARCHAR2(1000);

l_rest_url    VARCHAR2(1000);

l_token_url   VARCHAR2(1000);

BEGIN

l_body:= '{"id":'||id||', "data": '||data||', "cand_code": '||cand_code||'}';

      apex_web_service.g_request_headers(1).name := 'Content-type';

  apex_web_service.g_request_headers(1).value := 'application/json';

               

l_response_clob := apex_web_service.make_rest_request(

                  p_url => 'https://apex.oracle.com/pls/apex/praticedemo/abc1/dev/',

                  p_http_method =>'POST', 

                  p_body => l_body

                   

   );

htp.p(apex_web_service.g_status_code);

                

                

END RESTFUL_IMAGE;


************Call Procedure *****************


begin

RESTFUL_IMAGE ('23', '2267', '21111');

end;



Stay Informed:  Stay up-to-date with the latest Oracle APEX tips and updates by following my social media profiles.

 Follow on YouTube:  Dive deeper into Oracle APEX by exploring my YouTube channel for tutorials and insights: 

 YouTube Channel: YouTube


Connect on LinkedIn:  Let's connect on LinkedIn for networking opportunities, discussions, and more: 

 LinkedIn Profile: Linkedin


Comments

  1. Hello Sir: Thank you very much for APEX your video to stage and upload excel file. I am calling a package from APEX. This package calls and executes OE_ORDER_PUB.PROCESS_ORDER API to create OM order on Oracle r12 12.2. How can I capture error and exceptions from the package and this API to display in APEX ?

    ReplyDelete
  2. Hi, Dear , can you please elaborate one more thing " how to create Oracle APEX RESTFUL API for remote database like EBS.

    Regards.

    ReplyDelete

Post a Comment