SK SKYVVA Documentation

2. How to create REST interface using the Agent REST Adapter?

1. How to use it?

Adapter Agent REST has three authentication types to use when calling out to a rest web service and it has handle response type XML and JSON. Here is the authentication type we support :

Agent Rest adapter is supporting :

Handle API message without Response interface using Basic Adapter

Step 1: Create or upload message type

Step 2: Create Integration

Step 3: Configuration Agent Control board

Step 4: Create an Adapter on Agent Control Board

Step 5: Link Adapter into an interface

[aux_code language="javascript" theme="tomorrow" title="" extra_classes=""]skyvvasolutions.CallOutControl c=new skyvvasolutions.CallOutControl(); c.returnXml=true; c.returnListRecord=true; c.isCreateMessage=true; c.actionDoIntegrate=true; String[] ids=new String[]{'0011x000018SiQAAA0'}; skyvvasolutions.Iservices.invokeCalloutV3('Adapter_Agent_Rest','Outbound_Basic_Authentication',ids,'SYNC', c); [/aux_code]

Native to debug -> open execute anonymous window

Handle API message with Response interface

In this case, we just need to create a Response Interface using Message Type. Pre requires

How to handle API message with response interface

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]Note you make sure that the message type response interface is matching with payload response of another request system or server.[/su_box] Step 1: Create Interface

Step 2: Put response interface into the Request interface

Step 3: Callout V3 with apex code with request interface [aux_code language="javascript" theme="tomorrow" title="" extra_classes=""]skyvvasolutions.CallOutControl c=new skyvvasolutions.CallOutControl(); c.returnXml=true; c.returnListRecord=true; c.isCreateMessage=true; c.actionDoIntegrate=true; String[] ids=new String[]{'0032x000004XV2dAAG'}; skyvvasolutions.Iservices.invokeCalloutV3('Adapter_Agent_Rest','OutBound_Basic_Authentication',ids,'SYNC', c); [/aux_code]

Handle API message without Response interface using OAuth2.0 Authentication

In this case, we just need to create an Adapter type OAuth2.0 authentication. Pre requires

Step 1: Create Adapter Agent REST This authentication we test callout from salesforces.

Step 2: Create an outbound interface In this case, we need two outbound interface

Step 3: CallOut V3 Apex code

Handle API message with Response interface

In this case, we just need an Inbound interface one more for doing response. Because we have configuration some pre-required already. Step 1: Create a response interface

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]User have to make sure the payload matching the message type[/su_box]

Step 2: Put response interface into a request interface

Handle API message without Response interface using API Key Authentication

Pre requires In this case, we have some requirements from another case you just create adapter type API Key authentication. Step 1: Create adapter Agent Rest Create adapter type agent rest API key authentication

Step 2:  Create an outbound interface

Step3: Call out by apex code

Handle API message with Response interface

In this case, we just need an inbound interface one more to do response because we have some pre-requires already. But you make sure the payload is matching the message type. Step1:  Create an inbound interface

Step 2: Put response interface into a request interface

Step 3:  Call v3 by apex code Here is an example in the developer console

Supports isArray on properties message type and field for multiple picklist values

We have data type a data picklist(Multi-Select) not Sobject which should be generated in the JSON array of the JSON outbound payload. Now we are able to generate it. Step1: Metadata Provider Go to message type using rest template

Step2: Create an outbound interface Create an outbound interface and link metadata provider into the interface.

Do mapping custom field that has multi-picklist with message field entry checked isArray properties. We need to check the cache monitor to ensure that adapter, Integration, interface group, interface, Ichain, mapping, or workflow that we set on an interface is cache retrieved.

Summary

Finally, this feature has been explained to you how to use the Agent REST adapter to call out to other systems with the response interface. This adapter is useful for the user who wants to import or export data with the internal and external systems in synchronous and asynchronous modes.

Open this article in the interactive viewer →