Rest Api
Rest Api
The acronym REST stands for Representational State Transfer, this basically means that each unique
URL is a representation of some object. REST describes a set of architectural principles by which data
can be transmitted over a standardized interface (such as HTTP)
In a RESTful Web service, requests made to a resource's URI will elicit a response that may be
in XML, HTML, JSON or some other defined format. The response may confirm that some alteration
has been made to the stored resource, and it may provide hypertext links to other related resources or
collections of resources.
HTTP Methods
The following HTTP methods are most commonly used in a REST based architecture.
200
1
OK − Shows success.
201
2 CREATED − When a resource is successfully created using POST or PUT request. Returns
link to the newly created resource using the location header.
204
3
NO CONTENT − When response body is empty. For example, a DELETE request.
304
4 NOT MODIFIED − Used to reduce network bandwidth usage in case of conditional GET
requests. Response body should be empty. Headers should have date, location, etc.
400
5 BAD REQUEST − States that an invalid input is provided. For example, validation error,
missing data.
401
6
UNAUTHORIZED − States that user is using invalid or wrong authentication token.
403
7
FORBIDDEN − States that the user is not having access to the method being used. For
example, Delete access without admin rights.
404
8
NOT FOUND − States that the method is not available.
409
9 CONFLICT − States conflict situation while executing the method. For example, adding
duplicate entry.
500
10 INTERNAL SERVER ERROR − States that the server has thrown some exception while
executing the method.
REST Web Services are available in Oracle E-Business Suite Release 12.2.3 and onwards only. REST
based web services are deployed on Oracle E-Business Suite’s application server. They do not dependent
on Oracle SOA Suite and Oracle Applications Adapter.
Display all Oracle E-Business Suite integration interface definitions through Oracle Integration
Repository.
Support custom integration interfaces from Oracle Integration Repository
Provide service enablement capability (SOAP and REST services) for seeded and custom
integration interfaces within Oracle E-Business Suite
Use the Integration Repository user interface to perform design-time activities such as generate
and deploy Oracle E-Business Suite Web services
Support synchronous interaction pattern for REST-based Web services
Support multiple authentication types for inbound service requests in securing Web service
content
Enforce function security and role-based access control security to allow only authorized users to
execute administrative functions
Provide centralized, user-friendly logging configuration for Web services generated through
Oracle E-Business Suite Integrated SOA Gateway's service provider
Audit and monitor Oracle E-Business Suite inbound service operations from Service Monitor
Leverage Oracle Workflow Business Event System to enable Web service invocation from Oracle
E-Business Suite
Exposing Standard API as REST Web Service and Invoking it.
Here we will take an example of creating an Employee by exposing HR_EMPLOYEE_API Interface API
and then invoking it to create Employee.
Following steps will explain the process of exposing the standard API and then invoking it.
Step 2: Click on the search result, it will display List of methods available in the Interface
Package.
Step 3: Enter the value “Employee” in the field Service Alias (Mandatory). Check “Create
Employee” under Service Operations.
Step 4: Now click on the Deploy to make the REST web service active and usable. You will
receive message that service is successfully deployed and the status will be deployed
Step 5: Now you will see the link to WADL file, Click on the link. It shows the
physical location of the service endpoint where the service is hosted.
Now open the link highlighted in RED in new Browser window, it will show the XSD file with
input parameters that will be used later for invoking the Web Service.
Step 6: In case you want to assign Grants to a group of user. You can do so and only those
people in the group can access and perform operation via REST APIs.
Authorization by clicking on Add new header link then enters the application
username/password by clicking on construct.
Then enter Accept, Content Type and Language. Select application/json in the Content
Type and Accept below.
Link: http://hansel.rapidflowapps.com:8002/webservices/rest/Employee/create_employee/
Payload:
{
"CREATE_EMPLOYEE_Input": {
"@xmlns": "http://xmlns.oracle.com/apps/per/rest/Employee/create_employee/",
"RESTHeader": {
"xmlns": "http://xmlns.oracle.com/apps/per/rest/Employee/header",
"Responsibility":"US_HRMS_MANAGER",
"RespApplication":"PER",
"SecurityGroup":"STANDARD",
"NLSLanguage":"AMERICAN",
"Org_Id" :"204"
},
"InputParameters": {
"P_HIRE_DATE": "2015-06-28T09:00:00",
"P_BUSINESS_GROUP_ID":"202",
"P_LAST_NAME":"Negi",
"P_SEX":"M",
"P_PER_COMMENTS":"Create From REST Service",
"P_DATE_OF_BIRTH":"1979-01-04T09:00:00",
"P_EMAIL_ADDRESS":"[email protected]",
"P_FIRST_NAME":"Praveen",
"P_KNOWN_AS":"Praveen",
"P_MARITAL_STATUS":"S",
"P_MIDDLE_NAMES":"Singh",
"P_NATIONALITY":"AM",
"P_NATIONAL_IDENTIFIER":"183-25-2523",
"P_REGISTERED_DISABLED_FLAG":"N",
"P_COUNTRY_OF_BIRTH":"US",
"P_REGION_OF_BIRTH":"West",
"P_TOWN_OF_BIRTH":"San Francisco"
}
}
}
Step 10: Now to verify if an Employee is created in Oracle. Query the table
PER_ALL_PEOPLE_F to check the result.
Case - II : Creation Of User using REST API
Here we will take an example of creating a User by exposing FND_USER_PKG Interface API and then
invoking it to create user.
Following steps will explain the process of exposing the standard API and then invoking it.
Step 3: Enter the value “create_user_test” in the field Service Alias (Mandatory). Check
“Create/Update User” under Service Operations.
Step 4: Now click on the Deploy to make the REST web service active and usable. You will
receive message that service is successfully deployed and the status will be deployed
Step 5: Now you will see the link to WADL file, Click on the link. It shows the
physical location of the service endpoint where the service is hosted.
Now open the link highlighted in RED in new Browser window, it will show the XSD file with
input parameters that will be used later for invoking the Web Service.
Step 6: In case you want to assign Grants to a group of user. You can do so and only those
people in the group can access and perform operation via REST APIs.
Authorization by clicking on Add new header link then enters the application
username/password by clicking on construct.
Then enter Accept, Content Type and Language. Select application/json in the Content
Type and Accept below.
Link: http://hansel.rapidflowapps.com:8002/webservices/rest/create_user_test/load_row
Payload:
{
"LOAD_ROW_Input": {
"@xmlns": "http://xmlns.oracle.com/apps/fnd/rest/create_user_test/load_row",
"RESTHeader": {
"xmlns": "http://xmlns.oracle.com/apps/fnd/rest/create_user_test/header",
"Responsibility":"US_HRMS_MANAGER",
"RespApplication":"PER",
"SecurityGroup":"STANDARD",
"NLSLanguage":"AMERICAN",
"Org_Id" :"204"
},
"InputParameters": {
"X_USER_NAME": "TEST_USER",
"X_ENCRYPTED_USER_PASSWORD": "Welcome123",
"X_START_DATE": "20/04/2017",
"X_EMAIL_ADDRESS": "[email protected]"
}
}
}
Step 10: Now to verify if a USER is created in Oracle. Query the table
FND_USER to check the result.