Build REST
API in Oracle
Integration
Cloud (OIC)
OIC TRAINING
BY U N O G E E K S
HTTPS://WWW.UNOGEEKS.COM +91 73960 33555 1
Build REST API in OIC
Use Case: Build a REST API which takes firstName (String) as input, prefix Hello and send
it back as response
Create trigger connection with REST adapter
Trigger Connection determines:
Whether your integration is exposed as SOAP or REST Service
What request payload needs to be passed to invoke the integration.
Build the integration
Activate the integration
Test the REST API from OIC and monitor the request
HTTPS://WWW.UNOGEEKS.COM +91 73960 33555 2
Steps
1. Login to OIC
2. Create a REST connection (PK Hello World REST Conn) and selecting
security policy as Username Password
3. Create a new App Driven style Integration
PK Hello World REST Service
PK_HELLO_WORLD_REST_SERVICE
PK
HTTPS://WWW.UNOGEEKS.COM +91 73960 33555 3
Steps
4. Call endpoint – SayHello; URI: / SayHello/{Name}
5. GET, enable response, verify parameter
6. Enter response sample JSON as below
"Greeting" : "Hello John"
4. Edit mapping to concat ‘Hello’ to input received and map it to response
5. Enable tracking
6. Activate Service & Test it in OIC
HTTPS://WWW.UNOGEEKS.COM +91 73960 33555 4
Template Vs Query Params
Best practice for RESTful API design is that path params are used to identify a specific resource or
resources, while query parameters are used to sort/filter those resources.
Here's an example. Suppose you are implementing RESTful API endpoints for an entity called Car.
You would structure your endpoints like this:
GET /cars; GET /cars/:id; POST /cars; PUT /cars/:id; DELETE /cars/:id
This way you are only using path parameters when you are specifying which resource to fetch, but
this does not sort/filter the resources in any way.
Now suppose you wanted to add the capability to filter the cars by color in your GET requests.
Because color is not a resource (it is a property of a resource), you could add a query parameter that
does this. You would add that query parameter to your GET /cars request like this:
GET /cars?color=blue
This endpoint would be implemented so that only blue cars would be returned.
As far as syntax is concerned, your URL names should be all lowercase. If you have an entity name
that is generally two words in English, you would use a hyphen to separate the words, not camel
case.
HTTPS://WWW.UNOGEEKS.COM +91 73960 33555 5
THANK YOU
Unogeeks Training Institute
+91 73960 33555
[email protected]
https://www.unogeeks.com
https://www.unogeeks.com 6