Prabhu M
Prabhu M

Reputation: 3600

cURL commands in java

How to use the cURl command

curl https://na1.salesforce.com/services/data/v20.0/query?q=SELECT+name+from+Account -H "Authorization: Bearer access_token" -H "X-PrettyPrint:1"

in java to call sales force rest web services

Upvotes: 2

Views: 1635

Answers (3)

Koziołek
Koziołek

Reputation: 2874

Easiest way is to download cURL java wrapper like https://github.com/pjlegato/curl-java and use cURL directly in your code.

Second way is to use Runtime.getRuntime().exec("crul...") "pattern" and run curl as a normal process.

Upvotes: 0

rmuller
rmuller

Reputation: 12869

For interacting with the salesforce API, it is best to use a client library and not implement it all by yourself, see http://blog.palominolabs.com/2011/03/03/a-new-java-salesforce-api-library/ for an example.

Upvotes: 0

Siddharth Gupta
Siddharth Gupta

Reputation: 897

Java has an URLConnection Class that has similar functions as cURL.

Upvotes: 2

Related Questions