Discussion

2
Replies
2196
Views
SHIVA2010 Member since 2012 24 posts
Virtusa
Posted: 4 years ago
Last activity: 2 years 7 months ago
Closed

Calling a Salesforce REST service from Pega

Hi,

I have requirement to call a SalesForce REST service from pega. for this first i have tried to do that in Post man tool and am able to call the REST Service. So i am doing 2 service calls. first service call is to get the access token(sending grant_type,client_id,client_secret,username,password as form data. Link:https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_res…) and the other service is to call the actual REST service using the access token.

In Pega, i am trying with 2 approaches.

Approach1:
First i tried to use the OAuth authentication type in the Connector. Followed your post in the below link.

https://pdn.pega.com/forums/rest-conenctor/unable-to-construct-json-for…

1. Created the Oauth data instance.

2. Referred this Oauth name in Authentication profile and referred the authentication profile in connctor rule where i am trying to call actuall REST service.
This approach is failing in activity pyConnectOAuthProvider at step2. It is tring open "Data-Admin-Security-OAuth-Client-AccessToken" instance using consumer key and operator id.

Approach2:

I am trying to send the grant_type,client_id,client_secret,username,password in body. As the REST service is expecting these parameters as form data, i am not sure how to pass as form data. So i tried sending these parames separated by & in the Message body.

Ex: grant_type=password&client_id=

This giving me the below response.

{
"error": "unsupported_grant_type",
"error_description": "grant type not supported"
}

Please suggest me.

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Data Integration
Moderation Team has archived post
Share this page LinkedIn