13.5.2 Invoking a REST Operation Programmatically
You can invoke a REST Data Source operation programmatically, treating it like a function call instead of a row set.
Consider a company selling books that offers a REST API at the following endpoint URL:
https://example.com/ords/cloudcompanion/orders/singleBookCreateIt lets a caller
POST a JSON payload like the following to order some quantity of a single book:{
"isbn": "978‑1565926912",
"quantity": 1
}The API responds with an order confirmation payload containing:
{
"orderNumber": 12345,
"estimatedDelivery": "2025-07-06T00:00:00"
}After configuring a REST Data Source with appropriate Data Profile columns and a POST operation having the required Request Body Template, you invoke it programmatically using the EXECUTE_REST_SOURCE procedure in the APEX_EXEC package.
- Configuring REST Source for Invocation
When a REST API has noGETmethod or OpenAPI description to automatically discover, you can define the operations and data profile columns manually. - Invoking REST Operation in Code
UseEXECUTE_REST_SOURCEin theAPEX_EXECpackage to invoke a REST operation in code.
Parent topic: Using REST APIs in Code