Learning Object :-
This unit describes about:-
- What is searchService?
- How to use the searchService to build the interface to query data from salesforce.
1. What is searchService API? #
The searchService api is working as the query method of HTTP request. We have integration and interface configuration where we mapped objects as per our requirements. So when we use search service API, we actually query the data we have mapped for our interface. So it will return the data of the object as per mapping of interface. We can use the REST api SearchService or the soap API.
In this tutorial we used postman application where Request payload means the body we have pass through postman and endpoint url is the url we have pasted on postman and in response we will get JSON data as parent and child by using searchService API.
2. How to use the searchService to build the interface to query data from salesforce? #
The procedure is given below :-
Pre-Requisite :-
- Create Metadeta provider.
- Create Istructure Repository.
- Create Message type e.g AccountMT is the parent of ContactMT.
- Create Integration.
- Create Outbound Interface then select Status is Deployed and Operation Type with Query (As shown in the picture given below):-
- Add Metadata Provider, Istructure Repository, Message Type for interface(As shown in the picture given below):-
- Do tree mapping field Salesforce object map with Message Type step by step with the level (As shown in the picture given below):-
- Check the select statement Query editor as shown below:-
- Navigate to Postman application.
- Create a new request and a new folder.
- Change method GET to POST and enter Salesforce classic URL with /services/apexrest/skyvvasolutions/SearchService (shown in the picture given in point 8).
- Click Body tab => click raw tab => select JSON (application/json) in picklist => Create rest body
The body is shown below in the picture.
{
"INTEGRATIONID" : "xxxxxxxxxxxx",
"INTERFACENAME" : "xxxxxxxxxxxx"
}
- Click Header tab => enter Authorization for Key cell => create Bearer with sessionId.
(As shown in the picture given below).
- Click Send button to get response data.
- Here is the result of the responded JSON data.