Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

salesforce intergration - salesforceclient

Avatar

Avatar
Validate 10
Level 3
sathya_prakasha
Level 3

Likes

22 likes

Total Posts

98 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 10
Level 3
sathya_prakasha
Level 3

Likes

22 likes

Total Posts

98 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile
sathya_prakasha
Level 3

20-11-2019

Hi,

how to add authorization header in salesforce client

Rest URL : curl https://yourInstance.salesforce.com/services/data/v20.0/query/?q=SELECT+name+from+Account -H "Authorization: Bearer token"

salesforceClient = createSalesforce(cloudConfiguration);

log.info("salesforcecelinet>>>>>>>>>>>"+salesforceClient);

salesforceClient.setMethod(SalesforceClient.AvailableMethods.GET);

salesforceClient.setContentType("application/json");

baseUri = salesforceClient.getInstanceURL() + REST_ENDPOINT + API_VERSION ;

String uri = baseUri + "/query/?q=SELECT+name+from+Account";

salesforceClient.setPath(uri);

try {

     response = salesforceClient.executeRequest();

}

Regards,

Sathya

Replies

Avatar

Avatar
Validate 10
Level 3
sathya_prakasha
Level 3

Likes

22 likes

Total Posts

98 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 10
Level 3
sathya_prakasha
Level 3

Likes

22 likes

Total Posts

98 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile
sathya_prakasha
Level 3

21-11-2019

I am getting the below the error while trying to establish the connection with salesforce client

om.adobe.cq.mcm.salesforce.SalesforceClient Error while Executing GET Request to Salesforce.com:

java.net.UnknownHostException: ap16.salesforce.comhttps

at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)

at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source)

at java.net.InetAddress.getAddressesFromNameService(Unknown Source)

at java.net.InetAddress.getAllByName0(Unknown Source)

at java.net.InetAddress.getAllByName(Unknown Source)

at java.net.InetAddress.getAllByName(Unknown Source)

at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:112) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:373) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108) [org.apache.httpcomponents.httpclient:4.5.4]

at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) [org.apache.httpcomponents.httpclient:4.5.4]

at com.adobe.cq.mcm.salesforce.SalesforceClient.internalExecuteRequest(SalesforceClient.java:425) [com.day.cq.mcm.cq-mcm-salesforce:1.7.2]

at com.adobe.cq.mcm.salesforce.SalesforceClient.doExecuteGetRequest(SalesforceClient.java:354) [com.day.cq.mcm.cq-mcm-salesforce:1.7.2]

at com.adobe.aem.guides.wknd.core.SalesforceConnectionImpl.createSalesforceConnection(SalesforceConnectionImpl.java:67) [com.adobe.aem.guides.aem-guides-wknd.core:0.0.1.SNAPSHOT]

at com.adobe.aem.guides.wknd.core.SalesforceData.init(SalesforceData.java:55) [com.adobe.aem.guides.aem-guides-wknd.core:0.0.1.SNAPSHOT]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)