+ Start a Discussion
Jaime StuardoJaime Stuardo 

how to get API URL


I need to pass some information from an e-commerce site to Salesforce. Salesforce already has a SOAP API where I can connect to send the data.

How can I know the actual API URL?

For example, one of those URL could be https://test.salesforce.com/services/Soap/c/37.0/0DF190000008OTI. That URL is active since when you place it in browser, server responds with an error telling that only POST request is allowed.

But that URL is not the endpoint of my API.

How can I know it? what is the "0DF190000008OTI" part?

Raj VakatiRaj Vakati

Please see my comments 

1 . need to pass some information from an e-commerce site to Salesforce

Raj - Salesforce has both SOAP and rest apis so its matter of what is going to fit your needed .. use the salesforce rest api  if possiable 

You can know the URL based on the C and u as shon below 
Enterprise WSDL:
String authEndPoint = "https://login.salesforce.com/services/Soap/c/37.0/"
String authEndPoint = "https://community-domain/path-prefix/Soap/c/37.0/"
Partner WSDL:
String authEndPoint = "https://login.salesforce.com/services/Soap/u/37.0/"
String authEndPoint = "https://community-domain/path-prefix/Soap/u/37.0/"

 "0DF190000008OTI"  - Is your Org Id 
Jaime StuardoJaime Stuardo
Hello... thanks for your reply.

I am using POST because we send several information to SalesForce.

I want to do tests in sandbox. I have identified which Apex class receives the information and create the oportunity with that information, however, I have read some things about this. For example, this URL https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_remote_site_settings.htm tells how to add a remote site to avoid unauthorized access.

First step says: "From Setup, enter Remote Site Settings in the Quick Find box, then select Remote Site Settings."...

I enter Setup but I could not find where "Remote Site Settings" is. Can you tell me, please?

After I defined the remote site, I need to get the URL to the Apex class. I only know its name and when I load Apex class designer, I don't see any place where I can get the URL neither any place where I can get the WSDL (I need to know the WSDL too).

Can you help me further, please?

Rishab TyagiRishab Tyagi
Hello Jamie,

I assume that your eCommerce site is built in PHP? Using SOAP for passing data from the eCommerce server to salesforce server is somewhat an ideal choice in the current scenario. However, accessing the SOAP API directly would be a bit tricky task. I would recommend that you use the respected SOAP library for your respected platform.

For PHP: https://github.com/developerforce/Force.com-Toolkit-for-PHP
For JAVA: https://github.com/forcedotcom/wsc
For Node.js: https://github.com/jsforce/jsforce

Also, the WSDL file would be generated from Setup -> Develop -> API. In there go to Generate API WSDL and save the generated XML file to use for SOAP API (WSDL is required to access SOAP API).

Hope that answers your question.
Jaime StuardoJaime Stuardo

This is an already developed Java application where I need to add only 1 parameter to be sent to salesforce, so it is not my business to deal with libraries and nothing like that.

I added the new parameter to the SOAP body the same way other parameters are being added, so I think it should work,

I need the other part now, to test the new parameter in Salesforce. For that, I need to know the sandbox URL of the Apex class.

The application has this code to connect to SalesForce:

LoginEndpoint loginEndpoint = new LoginEndpoint(); loginEndpoint.setUrl(salesforceUrl); loginEndpoint.setUsername(salesforceUsername); loginEndpoint.setPassword(salesforcePassword);
So I need the URL, the username and the password.

Username and password coresponds to the same credentials I use to log in to Sandbox in the browser?

And about the URL how can I get it? Class I need to invoke has API version 37.

I am wondering about other thing. Maybe I am not going to the right direction. I need just to add a value to a new property created for an opportunity, Is it really necessary to have an Apex class to accomplish it? new opportunity property is already created and as I told you, I am sending from the Java program the same way as the other parameters are being sent. Besides that, in no part of the Java code, the Apex class name is referenced.

So I am thinking that the URL I need to invoke is not the URL of an apex class but a general URL that acts as the entry point to Salesforce. If that entry point receives the new parameter property value for opportunity, Salesforce will do that job. Is that simple or is there something else to worry about?

Jaime StuardoJaime Stuardo

I have discovered something else. Java program is adding this to the SOAP envelope: urn:enterprise.soap.sforce.com

So, I saw the enterprise WSDL and I could see all parameters under "Opportunity" object. Therefore I think problem is reduced only to know the URL and credentials for that enterprise WSDL. Where can I get such an information?

Furthermore, do I need to authorize my development PC to be able to call that WSDL?

Rishab TyagiRishab Tyagi
Hello Jamie,

Sorry for the late reply. I hope that you have found the solution to your question. However, if you are still stuck somewhere or want to further explore the SOAP API of any system then you can download and install the application SOAP UI. This application provides an interface to call the SOAP API of any system and also generates generic requests for all the available webservices in your system. You can also get the URL that you need to hit with this application.