function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DevSFDevSF 

Using REST(JSON) Get data from External website

Hi,

My task is to integrate salesforce with externl website using REST. & they have given me JSON Response code for fields in external website.

I am able to hit the External system URL. I was Struct here...!  and how we can get data from external website & how to code for that...?
Like whenever a user enter their account details in external website, those data should also get into salesforce accounts.

How we can achieve this...?
can anyone help for this scenario...!

 
Daniel BallingerDaniel Ballinger
You will probably want to use the Salesforce APIs to send data from the externam website into Salesforce once the form is completed. Since you are already using REST for outbound calls from Salesforce you could also use it for inbound calls.

See Create a Record (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm) in the REST API developer guide. 

The alternative is that you have Salesforce periodically poll the external system for the Account records.
pconpcon
You'll want to use the REST callout [1] and then parse the JSON data [2].  I'd recommend reading over these articles and if you have any specific questions, please feel free to add them here.

[1] https://developer.salesforce.com/trailhead/module/apex_integration_services
[2] http://blog.deadlypenguin.com/blog/2015/11/30/json-deserialization-in-salesforce/
DevSFDevSF
Thank you @ daniel 7 pcon.

But what's the problem now is how we can push data into salesforce 
and how do you get those pushed data from external website (or) how we can use that data.

Thanks,
Anshul
Laxman Vattam 26Laxman Vattam 26
You can refer below sample codes to implement custom REST APIs:
https://yoursalesforceguide.blogspot.com/2016/12/calling-external-rest-service-from.html
https://yoursalesforceguide.blogspot.com/2016/12/exposing-apex-functionality-through.html
Subham Agarwal 19Subham Agarwal 19
I believe you have to expose a method that will be consumed by the external application.
Whenever user clicked on the save Account button, a call out from the external application to Salesforce will happen and the exposed service will be called.
Get the response structure and create a wrapper in Salesforce.
Deserialize the response into Account instance
Do some transformation if required
Save the data and return the response code

Thanks
Marvin FontanillaMarvin Fontanilla
hi please someone help me on my concerns 

https://developer.salesforce.com/forums/ForumsMain?id=9060G000000BhQnQAK

Thanks!