I am trying to implement SOAP-API for Java and find that the authentication is 2 step using the REST and then passing the token in the SOAP header. I also downloaded the example from http://help.exacttarget.com/en/technical_library/web_service_guide/getting_started_developers_and_the_exacttarget_api/connecting_to_the_api_using_java_and_axis2/

In the example I dont find the REST api call but username and password. Which is the correct way to authenticate?

Thanks --Narasimha

2 Answers 2


Generally with the SOAP API you have two ways to authenticate a request with Salesforce.

  1. You use the login API call with the username and password to get a SessionID and corresponding Server URL to make the subsequent API calls to. The SessionId should be sent via the SessionHeader. Typically you will need to append the security token to the password unless your IP address has be added to the Org.
  2. You use an alternative means to get a valid Session Id and proceed directly to using the SessionHeader.

There are several alternatives for getting a valid Session Id. OAuth 2.0 is the preferred method if you are requesting credentials from individual users. By selecting the correct flow there is no need for the user to give your app their username and password. Instead you get the resulting access token that can be used for API calls. Generally speaking the access token is interchangeable with the session Id (depending on the requested scopes).


You use a username, password, and security token for the SOAP API. The access token, in which you do not use your username and password, is for the REST API.

With a username, password, and security token, you POST to the SOAP API, and then Salesforce will give you a Session ID to interact with standard objects.

With the REST API, you are given a client ID, client secret, and you POST those credentials to Salesforce to get an access token so that you can interact with custom objects.

  • 2
    Downvoted for "The SOAP API is for standard objects, and the REST API is for custom objects.". Both APIs can equally access standard and custom objects. Commented Mar 19, 2015 at 20:40
  • Oh, wow... I was told all along the REST API was for custom objects only...
    – amlmf1
    Commented Mar 20, 2015 at 1:27
  • See Rest API: for "Sales Objects" or "Standard Objects?". BTW, feel free to change your answer. I'd happily reverse the downvote. Commented Mar 20, 2015 at 2:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .