简体   繁体   中英

SalesForce REST API cURL to Java or Web Browser

I have gotten Salesforce REST API to work via cURL, as the below quoted command passes into cmd prompt and returns all the leads in Salesforce.

I also have these values: Access Token, AuthorizationUrl, Customerkey, Customersecret, id (I believe Salesforce ID), instanceURL, loginURL, issuedat, refreshToken, and signature.

Instead of getting the result in cmd prompt via cURL, I wish to get it in the Browser and/or via a java application.

The reason is to allow a third party (java) application call this REST API to extract and parse the leads.

Any help is appreciated.

Thank you.

curl -v https://na22.salesforce.com/services/data/v31.0/sobjects/lead -H "Authorization:Bearer 00D15000000FaI8/!ASAAQFLdTJ7lhkru9y9HA7iIPOPwjb3a8uORHjCPCtNB9pSWWeFeIJ_Q4QOA6tU3Kq2kmQby7CH4sigoTBhCjE3NlJ6uLvN3" -H "X-PrettyPrint:1"

We can use Spring's RestTemplate to call any REST API. Here is an example of how to use rest template with custom headers. Also, if the response type is json then we can use Jackson to cast response into object and access the fields as explained here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM