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
Cloud AtlasCloud Atlas 

Streaming API

Can Streaming API be used to get data from external API into SFDC rather than send from SFDC ???
So basically Salesforce acts as a client rather than server..
Best Answer chosen by Cloud Atlas
John TowersJohn Towers
Per the Saleforce docs, the Streaming API is only for events generated by Salesforce and pushed elsewhere:
Use Streaming API to receive notifications for changes to Salesforce data that match a SOQL query you define, in a secure and scalable way.
  • These events can be received by:
  • Pages in the Salesforce application.
  • Application servers outside of Salesforce.
  • Clients outside the Salesforce application.
Depending on your use case Salesforce has other methods that might work.

Apex REST might work for you. It allows you to create an Apex method that acts as an API endpoint and can act on the data it receives when that endpoint is called. There's a good example here (https://developer.salesforce.com/page/Creating_REST_APIs_using_Apex_REST). You would just creat the rest method and then configure your service to post to that endpoint when something happens that Salesforce needs to know about.

All Answers

John TowersJohn Towers
Per the Saleforce docs, the Streaming API is only for events generated by Salesforce and pushed elsewhere:
Use Streaming API to receive notifications for changes to Salesforce data that match a SOQL query you define, in a secure and scalable way.
  • These events can be received by:
  • Pages in the Salesforce application.
  • Application servers outside of Salesforce.
  • Clients outside the Salesforce application.
Depending on your use case Salesforce has other methods that might work.

Apex REST might work for you. It allows you to create an Apex method that acts as an API endpoint and can act on the data it receives when that endpoint is called. There's a good example here (https://developer.salesforce.com/page/Creating_REST_APIs_using_Apex_REST). You would just creat the rest method and then configure your service to post to that endpoint when something happens that Salesforce needs to know about.
This was selected as the best answer
Cloud AtlasCloud Atlas
Thanks John.
Really appreciate your response.
I already have a REST service in a Batch job getting the data currently.
The problem is we are modifying our endpoint and running into timeout issue.
So we are looking at options other than REST to try and real-time the data.

Thanks!