Salesforce support the way to get the request and provide the response from third party sites. It is RestResource.
Pre-requisite:
- Authentication with Salesforce.OR You can setup force.con site and expose that class so, you can invoke it without authentication.
- RestResource annotated class.
Go through below link to setup rest resource:-
Add a Class as a REST Resource
A sample class look like this:-
@RestResource(urlMapping='/Merchandise/*')
global with sharing class MerchandiseManager {
@HttpGet
global static Merchandise__c getMerchandiseById() {
RestRequest req = RestContext.request;
String merchId = req.requestURI.substring(
req.requestURI.lastIndexOf('/')+1);
Merchandise__c result =
[SELECT Name,Description__c,Price__c,Total_Inventory__c
FROM Merchandise__c
WHERE Id = :merchId];
return result;
}
@HttpPost
global static String createMerchandise(String name,
String description, Decimal price, Double inventory) {
Merchandise__c m = new Merchandise__c(
Name=name,
Description__c=description,
Price__c=price,
Total_Inventory__c=inventory);
insert m;
return m.Id;
}
}
You can also generate wsdl from above and consume it on third party site.
Other thing:-
If you are looking for standard operations in Salesforce ex: create/update a record, delete record etc. This available natively. Below are some sample code:-
There is a wsdl generated from Salesforce which is consumed in above examples.