+ Start a Discussion
Sachin_KSachin_K 

Accessing Salesforce without using WSDL

Hi,

 

Normal we access Salesforce (outside Salesforce enviroment) through web services generated from WSDL file.

 

I have a requirement in which I can not deploy WSDL web services at client end. Is there some way we can access Salesforce (from outside Salesforce enviroment) without using WSDL web services.

 

Thanks,

Sachin 

 

SuperfellSuperfell

Yes, you can use the REST API, see the docs for getting started info.

Sachin_KSachin_K

Thanks for the reply simon. This was helpful

Sachin_KSachin_K

Hi,

 

I tried using the salesforce rest API, but i getting error 400 in the response. I tried out following request URL:

https://instance-name.salesforce.com/services/oauth2/token

 

I tried it using poster and chrome advanced Rest client. Am I getting error because I am not using Curl. Is Curl manditory for making Salesforce rest api calls. Also if some one have some sample code please let me know.

 

Thanks,

Sachin

 

 

SuperfellSuperfell

No curl is not required, you can use anything that can geneate valid http requests. what does the response body say when you get the 400 response, what does the request look like?

SuperfellSuperfell

also, the token service is at https://login.salesforce.com/services/oauth2/token, not the instance host.

bhuyadavbhuyadav

Hi,

 

For initial observation and watching the rest request/response back and forth, you might consider using https://apigee.com/resources/salesforce ...

 

Apigee console does the OAuth itself so you will be able to play with Rest API purely.

Mohith Kumar ShrivastavaMohith Kumar Shrivastava

Hi Sachin Poster is very good Tool to use for Rest api ,

 

Please follow the following steps:

 

1)https://login.salesforce.com/services/oauth2/token

Use this first as a request URL to get access token .Please use test.salesforce.com for sandbox

2)To obtain access token you must Use POST http call:

In the payload use 

grant_type=password&client_id=<your_client_id>&client_secret=<your_client_secret>&username=<your_username>&password=<your_password>

where client id,client secret you will get from your remote access settings and please append security token if you are making from unautorized IP range .Please use appropriate User Name and Password 

3)Once you POST to the service you will get acess token .Please save that for future requests

4)Next in the header add following parameter and its value as 

Name:Authorization

Value:Bearer +oauthtoken obtained (Bearer space and your oauth_token)

5)Now once you add header in request URL add your REST service URL in the request URL of Poster tool(eg:https://ap1.salesforce.com/services/apexrest/CaseManagement/v1/50090000004TBNU) 

 

Thanks,

 

Mohith

Mohith Kumar ShrivastavaMohith Kumar Shrivastava

Hi,

 

APIgee will not support if i form a custom wrapper Rest Service in my sandbox.Only tool that will help is Curl or Poster.Poster is less tedious .

 

Thanks,

 

Mohith.