Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle APEX 21.2 - Best way to call a REST API

McRiversDec 18 2023 — edited Dec 18 2023

What is the best way to set up a REST API call in APEX? I am trying to use the Google Translate API (basic) to send it text string(s) (queried from database into a Display Only page item) and target language code, and then have it return the translated string for me to replace in the DOM.

The url API call is:

https://translation.googleapis.com/language/translate/v2?key=[api_key]&source=[en]&target=[es]&q=[This is a sentence to be translated.]

I first set it up as a REST Data Source, but now thinking this is not the best way to do this as I do not know how to dynamically change the query params and then handle the JSON response that is returned. A REST Data Source seems to be more of a static data fetch in regards to the same params used for each call.

What is the best way to call a REST API? Pass in params dynamically? and then deal with the response? Ideally I would like to set this up in a way so that the whole app can reuse it.

I am trying to understand the differences (or different uses cases) for:

  • REST Data Sources (Shared Components)
  • REST Enabled SQL (Shared Components)
  • Legacy Web Service References (Shared Components)
  • RESTful Services (SQL Workshop)
This post has been answered by PetarSimic on Dec 18 2023
Jump to Answer
Comments
Post Details
Added on Dec 18 2023
2 comments
11,370 views