
Oracle SaaS applications provide, among others, a comprehensive set of REST APIs. Oracle Autonomous Database and the entire family of Oracle database product offerings provide rich and easy-to-invoke API mechanisms. Let’s see an example:
Creating a sales order
With a simple PL/SQL block of code we are showing down here how easy is to create a sales order.
declare result clob; payload CLOB; begin payload := '{"SourceTransactionNumber": 333,"SourceTransactionSystem": "OPS","SourceTransactionId": 333,"BusinessUnitName": "Sxcxrxtxs Dxrxct Xspxñx S.X.U","BuyingPartyName": "ES_NEW","TransactionType": "SBN WO","RequestedShipDate": "2020-03-01T00:00:00+00:00","PaymentTerms": "30 Net","TransactionalCurrencyName": "Euro","RequestingBusinessUnitName": "Sxcxrxtxs Dxrxct Xspxñx S.X.U","FreezePriceFlag": false,"FreezeShippingChargeFlag": false,"FreezeTaxFlag": false,"SubmittedFlag": true,"SourceTransactionRevisionNumber": 1,"lines": [{"SourceTransactionLineId": "1","SourceTransactionLineNumber": "1","SourceTransactionScheduleId": "1","SourceScheduleNumber": "1","TransactionCategoryCode": "ORDER","TransactionLineType": "Buy","ProductNumber": "2227","OrderedQuantity": 1,"OrderedUOM": "Each"}]}'; apex_web_service.g_request_headers(1).name := 'Content-Type'; apex_web_service.g_request_headers(1).value := 'application/json'; result := apex_web_service.make_rest_request( p_url => 'https://xyjk-lmno.fx.xm2.xrxclxclxxd.cxm/fscmRestApi/resources/11.13.18.05/salesOrdersForOrderHub', p_http_method => 'POST', p_username => 'felipitotacatun', p_password => 'yosigo', p_body => payload); dbms_output.put_line('result: ' || result ); end;
As you can see the procedure completes successfully:

And the new sales order gets created:

Hope it helps! 🙂
Hi
This is brilliant. But how to encrypt password rather than exposing in code?
LikeLike
You have several options, such as DBMS_CRYPTO package, KMS, …
LikeLike