You need to sign in to do that
Don't have an account?
Dhruv Khattar 8
Authorized URL for Apex Class?
I want to create a schedulable APEX class that fetches data from an external system using their REST API. For the other system, the developer needs to create an app, and enter an authorized URL for my "app".
How does one get a URL to my Apex class that his app can redirect to?
Thanks for your help!
This can be achieved via Apex REST API or Apex SOAP API:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest.htm
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_web_services.htm
For authorization, please refer here:
https://developer.salesforce.com/docs/atlas.en-us.208.0.api_rest.meta/api_rest/quickstart_oauth.htm
You may choose either mechanism i.e. OAuth 2.0 or Session ID.
https://yoursalesforceguide.blogspot.com/2016/12/calling-external-rest-service-from.html
Call back URL is important only when another website is interacting wtih Salesforce. In your case, you can just redirect to http://localhost:8080
@Laxman
I DO have an external system/website that I need to fetch data from. I need to request an authentication token to make data requests from that system. The external website needs a redirect URI to my application (APEX class) to be able to send that authentication token to it. Wondering what that redirect URI is for my apex class (or how I obtain it).
Tle link that BP Singh shared is the flip-side of my situation (i.e. the app that's being configured on the external service) and I need to provide the callback URI for that application.
As I mentioned in my previous comment, you need to make use of either Apex REST API or Apex SOAP API to expose a URL for your apex class so that external system can invoke it.
Let me explain with a quick high level template for Apex REST API,
@RestResource(urlMapping='/TestCallbackUri/*')
global class ApexRESTMyExample {
global static void myPostTestMethod(String s1, String s2) {
global static String myGetTestMethod() {
URI for this will be: https://yourinstance.salesforce.com/services/apexrest/TestCallbackUri
POST request will invoke method myPostTestMethod
GET request will invoke method myGetTestMethod
Hope this helps.