How To Call Apex API URL And Show JSON Data Report

How To Call Apex API URL And Show JSON Data Report

How To Call Apex API URL And Show JSON Data Report, Using XMLHttpRequest In Oracle Apex

 

Oracle REST Data Services (ORDS) || Apex Rest API To Use Oracle Apex Web service, You Need To Create A Variety Of Function Procedures And Users In The Oracle Database. Using XMLHttpRequest

The Complexity Of Oracle Web service Makes It Difficult To Call Our API. In Today's Post / Video, I Will Try To Show You In Detail How To Call And Show Report Of Any API Using JavaScript Function Using JavaScript Function. After Watching The Entire Post / Video, I Hope You Can Make Any API Data Call In Your Apex Application Via JavaScript. If You Have Any Problems And Questions Regarding This Post, Please Leave A Comment In The Comment Box Below Or Send A Message Via WhatsApp, Your Overall Cooperation Is Welcome.

If you want to know more about how to use Oracle REST Data Services (ORDS), You Can Watch My Previous Video And Post, The Link Is Given Below.

🔗 How To Use ORDS RESTful Services In Oracle Apex Video-
       URL-https://youtu.be/jmx1GenEYlM

🔗 How To Use ORDS RESTful Services In Oracle Apex BlogPost-
       URL-https://www.jaberit.com/2021/06/ORDSRESTfulServices.html

Steps To How To GET Data Use Apex API And Show Report, JavaScript

The Full Steps For Using How to GET Data Use Apex API And Show Report, JavaScript. The Following JavaScript Code Indicates The Basic HTTP Get Application.

1. First Check Your API Postman Or Any Other Means, Is JOSN Data GET Correctly? 
You Can Also View The API URL By Calling It In Any Browser 

If The API URL Is Correct, We Will Do The Next Step.

1. Create A Blank Page Name- User Page Permission
2. Create A New Item Name- Jason_Data
3.Create A New Button Name- Get_josn_data

Once All Our Regions, Items, And Buttons Have Been Created, We Will Now Create A Function. To Create A Function

4. Go To Function And Global Variable Declaration From The Properties Of The Application Paste The Script Of The Function Below-
        function get_api_data() {
    var xhr = new XMLHttpRequest();
    var url = "Use your API URL";
    xhr.open('GET', url, true);
    xhr.onload = function() {
             $s('P96_JSON',(xhr.responseText));
         }
     xhr.send();
}
Create A Dynamic Action Name – Call API
Action – Execute JavaScript Code
Code-
get_api_data ();

Our Work Is Almost Finished.

Now, By Clicking On The Get JOSN Data Button, You Can See If All The Data Of API Is Being Read Correctly In Jason Data Item.

Calling Our API To Fetch Data Is Over.
Now let's See How To Add Jason Data To Apex Collection And See The Report.

1. Create A Dynamic Action Opposite The Jason Item To Add To The Data Apex Collection. Name – Add Apex Collection
Event – Change
Action- Execute Server-side Code PL/SQL Code- Paste The Following Sql Code
DECLARE
    l_response   CLOB;
BEGIN
    l_response := :P96_JSON;
    apex_collection.create_or_truncate_collection ('REST_COLLECTION');
    apex_collection.add_member (p_collection_name   => 'REST_COLLECTION',
                                p_clob001           => l_response);
END;
2.Create An Interactive Report Type – SQL Query
SQL Query – Paste The Following SQL Code
SELECT x.OID,
       x.UNIT_NM,
       x.COURT_OID

  FROM apex_collections  c,
       XMLTABLE ('/json/items/row' 
                 PASSING apex_json.to_xmltype (c.clob001) 
                 COLUMNS OID VARCHAR2 (4000) PATH 'oid',
                         UNIT_NM VARCHAR2 (4000) PATH 'unit_nm',
                         COURT_OID VARCHAR2 (4000) PATH 'court_oid') x
 WHERE c.collection_name = 'REST_COLLECTION';

Make Changes According To Your Data.

Calling Data Using Our API URLs, Placing Them Within The Data Im And Showing The Report With The Data Of The Item Is Finished. If You Have Any Problems Or Suggestions Regarding API Calling Or This Post / Video, Please Comment Below. Your Cooperation Is Desirable. If You Feel The Need To Know How To Save The Data Of Apex Collection In The Table, You Can Come And See My Previous Post And Video.

Below Is The Link To The Post And Video. 

🔗 How to Save Collection Data, Apex Collection, Video-
       URL-https://youtu.be/3zsh1OrBKSQ
 

🔗 How to Save Collection Data, Apex Collection, BlogPost-
       URL-https://www.jaberit.com/2021/12/Save-Collection-Data-Apex-Collection-Part-2.html

 

🔗 Demo Application-
            URL- Demo Application
            Username - demo, Pass- demo

I hope everyone will like it. Please watch the full video,
Comment on any of your problems, I will try my best to solve the problem, In-Shah Allah. Everyone's cooperation is desirable. Visit my blog site, new technology related videos, you will get different types of tutorials of Oracle Apex, and hopefully, you can use them in your daily work.
Please stay tuned by subscribing to the YouTube channel, and encourages new videos to be uploaded.
=================
Visit my site to get more collaborative posts about Oracle Apex and subscribe to my YouTube channel. Thanks.
Comment on any of your issues, I will try my best to solve the problem, In-Shah Allah. Everyone's cooperation is desirable.
Visit my blog site, new technology-related videos, you will get different types of tutorials of Oracle Apex, and hopefully, you can use them in your daily work.
==============================

🙍🏾‍ Md jABER HOSSEN
📲 Mobile- +8801760688286
📨 Email- jaberit786@gmail.com
🌐 FB- facebook.com/mdjaber.hossen1
Please Subscribe to My Channel

Many thanks for visiting the site.

Then Enjoy.........................

Post a Comment

Hlo Sir

Previous Post Next Post