The Representational State Transfer (REST) adapter enables you to exchange messages between remote clients or web service servers and the Integration Server. It supports dynamic URLs, REST API polling, multiple operations per channel as well as XML and JSON data formats.
Rest adapter is used for data processing of both direction. I,e Inbound and outbound.
REST request-> Outbound interface
Rest response-> Inbound interface
What is REST request? #
REST requires that a client make a request to the server in order to retrieve or modify data on the server. A request generally consists of: an HTTP verb, which defines what kind of operation to perform. a header, which allows the client to pass along information about the request.
Request Structure:
{
"Google REST Service":{
"Request":{
"URL":{
"PATH Param":{
//Flate Strture..
},
"Query Param":{
//Flate Strture..
}
},
"Header":{
//Flate Strture..
},
"Body":{
//Custom Buisness Messagetype
}
}
}
}
What is Rest response? #
When an JSON String is sent to a REST service, you must set Content-Type HTTP header to be “application/JSON”. The REST service converts the XML input data to the JSON format that is accepted by REST services.
Response Structure:
{
//Custom Buisness Message Type like Account,Contact,Asset,Opportunity,Case
}
Resource Methods:
Other important thing associated with REST is resource methods to be used to perform the desired transition. A large number of people wrongly relate resource methods to HTTP GET/PUT/POST/DELETE methods.
Authentication Section:
Here we make authentication three-way like
1) Basic Authentication
2) Certificate Authentication
3) OAuth2.0 Authentication
1) If the authentication type is Basic then the following properties required.
Authentication Type: Basic,
API Service Endpoint URL,
Operation:GET|POST|PUT|UPDATE|DELETE,
Request Format,
Response Format,
username,
password,
REST URL Path Parameter(optional)
2)If the authentication type is Certificate then the following properties required.
Authentication Type: Certificate,
API Service Endpoint URL,
Operation:GET|POST|PUT|UPDATE|DELETE,
Request Format,
Response Format,
clientCertName,
clientCertPasswd,
REST URL Path Parameter(optional)
3)If the authentication type is Oauth2.0 then the following properties required.
Authentication Type: Oauth2.0,
API Service Endpoint URL,
Token Endpoint URL,
Operation:GET|POST|PUT|UPDATE|DELETE,
Request Format,
Response Format,
REST URL Path Parameter(optional)
OAuth 20 Flow: Username-Password Credential
//Below properties required for access service
OAuth 20 client-id
OAuth 20 client-secret
OAuth 20 access-token
OAuth 20 Flow: Client Credential
//Below properties required for access service
OAuth 20 client-id
OAuth 20 client-secret
OAuth 20 access-token
OAuth 20 refresh-token
OAuth 20 Flow: OAuth 20 refresh-token
//Below properties required for access service
OAuth 20 client-id
OAuth 20 client-secret
OAuth 20 access-token
OAuth 20 refresh-token
Message Type Template:
Rest Adapter Template
Rest Adapter Template
"Rest Service":{
"Request":{
"URL":{
"PATH Parameter":{
//flat Structure
},
"QUERY Parameter":{
//flat Structure
}
},
"Header":{
//flat Structure
},
"Body":{
//flat Structure
//Custom Hierarchical Business Message type
}
}
}
}
#
SetUp: #
Step1: Create Adapter
- First Insert Adapter Record By giving prefer Name and select Type = REST
- Now Insert Properties If Need Authorization.
- REST API Service Endpoint URL : “” , Insert Endpoint URL where Request will direct
- Username : “”, Your Endservice UserName
- Password : “”, Your Endservice Password
- Authentication : “BASIC”
- REST Operation : “POST”
Step2: Create message type for REST template
Manual create message type for REST template (google drive api)Manual create message type for REST template (google drive api)
Step 3: Create interface request(outbound) and interface response (inbound) , link interface inbound to outbound :Configuration on Interface using for google
How to Link response Interface:
Scroll the page to the Inbound/Outbound set up section. And select the response interface.
Link rest Adapter to Request interface
Mapping
- InvokeCallout3()
skyvvasolutions.CallOutControl c = new skyvvasolutions.CallOutControl();
c.returnJSONComplete=true;
c.actionDoIntegrate=true;
c.isCreateMessage=true;
String[] ids= new String[]{‘0011X00000TdIAXQA3′,’0011X00000TdIAYQA3′,’0011X00000TdIAZQA3’};
skyvvasolutions.Iservices.invokeCalloutV3(‘TEST-INTEGRATION’,’GoogleDrive_CreateFile_Request_POST_SK’,ids,’SYNC’,c);