Posts

Showing posts with the label rest

Make your RESTful APIs Secured with OAuth2 - Basic, Simple and Easy Steps

Its been a while since my previous article. So, here is my first blog post of 2020. Oracle APEX has an out-of-box and declarative support to create RESTful Web Services using ORDS. Within no-time, you can build and publish your RESTful APIs. Use of ORDS has gradually increased with common standard across different technology strongly adopted via RESTful Web Services and JSON formatted input/output. With the flexibility of data sharing across the technology or within application, we must also think of how secure my RESTful APIs are. We do believe in strong security of our applications using Authentication and Authorization. But, many times we miss the level of security we should implement in our RESTful APIs. So, here is the very simple and basic steps to secure your ORDS RESTful APIs using OAuth2: We will use a default oracle.example.hr web service module to add OAuth2 for this blog. Navigate to SQL Workshop > RESTful Services. From the left side of tree - click on "Ro...

Apex Office Print (AOP) - Performance issue with document merge using Converter API - SOLVED

Apex Office Print (AOP) is a great tool for document printing, document conversion and document merging. We have used AOP Converter API to merge pdf documents, and it works great. It was fast to implement and worked very well. We have observed during testing that we are hitting performance issue with large pdf files. I have used following apporach to overcome this. Following is the sample AOP API call where we were getting performance issue: l_blob_return := aop_api_pkg.plsql_call_to_aop(       p_data_type             => 'SQL',       p_data_source           => q'!select       'file1' as "filename",       cursor       (select            '1' as "dummy"        from dual       ) as "data"   from dual!',       p_template_type        ...

Create RESTful web service to download BLOB content

Image
I have been using RESTful API to download BLOB content as a file. This is very useful in many places where you want to give your BLOB document as a source to URL. This can be used within Oracle APEX or outside Oracle APEX. Following are the steps to create RESTful web service using Media Resource type to make your BLOB document downloadable. Use following link as a live demo, which will return product image for product_id = 1. https://apex.oracle.com/pls/apex/wstesting/demo/download_file/1 Hope this helps. Jaydip Bosamiya jbosamiya@gmail.com

How to create REST web service which returns JSONP data

Image
We are using JSON as data format with RESTful services quite a lot in Oracle APEX. But, purpose of this blog is to see how we can create RESTful services in Oracle APEX which returns JSONP. Problem Statement: When you have your own custom widget which is consuming RESTful web service, and that custom widget is going to be used by any third party website or can be called from a web page with different domain name. We do get following or similar error message in such cases. Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at {url}. This can be fixed by moving the resource to the same domain or enabling CORS. Proposed Solution: One of the solution is to have your JS code which is consuming RESTful services should get JSONP as a result. So, that will allow executing the cross-domain request without violating this error. Following are few useful links I came across: Click here to read more about JSONP. Click here to read more about h...

Integrate WooCommerce with Oracle APEX - A WordPress plugin for Customer, Product and Order management

Image
WooCommerce is one of the popular WordPress plugin and is widely used as a eCommerce platform. WooCommerce has provided REST web services to pull and push data.  But objective of this blog is to show you how one can use Webhooks  to automatically send new Orders to Oracle Database via APEX ORDS REST web services. This apporach can also be used for Order Updates/Customer Creation/Item Creation etc. To start with, once you have setup WooCommerce plugin in your WordPress admin side, go to settings and Webhoocks section as below: Topic field contains list of actions, which triggers the Delivery URL. You need to create each Webhook per Topic. There are predefined list of Topics in the list. Delivery URL field should have Full URL of APEX REST Webservice. Configure your REST web service as below in APEX: Following is the sample source code of REST Web service to read the data from Order JSON sent by WooCommorce: DECLARE   V_BODY BLOB; ...
My photo
Jaydip Bosamiya
I am Oracle APEX Consultant, Blogger and Integrator. All-rounder in building small, medium and enterprise applications. Extensive knowledge in various area of web-driven applications in Back-end (PL/SQL, SQL, Java), Front-end (Oracle APEX, HTML, JavaScript, CSS, jQuery, OracleJET, ReactJS), RESTful APIs, Third-party library integrations (Apex Office Print (AOP), Payment Gateways, Syncfusion, HighCharts) and APEX Plugins (HighChart, StarRating)