on 2022 Mar 11 8:15 PM
Hello Community, I've been exploring the /api/rd/v1/Cart API but we need to login from Salesforce in order to have all CPQ functionality and SFEnvironment. Has anyone been able to connect the API through this API /api/rd/v1/Core/LoginFromSalesforce? I keep getting {"Message":"Invalid login"} response.
I've been trying on Salesforce Developer Console > Execute Anonymous prompt with no success for a while now.
Thanks a lot.
String cpqHost = 'rssandbox.webcomcpq.com';
String cpqDomain = '<domain>';
String oppId = '<OpportunityId>';
String endpoint =
'https://' + cpqHost + '/api/rd/v1/Core/LoginFromSalesforce?' +
'sessionId=' + UserInfo.getSessionId() +
'&sfApiUrl=' + URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/u/54.0/' + UserInfo.getOrganizationId() +
'&sfApiPassword=Password' +
'&domainName=' + cpqDomain +
'&opportunityId=' + oppId
;
System.debug('Endpoint: ' + endpoint);
String reqBody = '';
Http h = new http();
HttpRequest req = new HttpRequest();
req.setEndpoint(endpoint);
req.setMethod('POST');
req.setHeader('Content-Length', String.valueOf(reqBody.Length()));
req.setHeader('Accept', 'application/json');
req.setTimeout(60000);
req.setBody(reqBody);
HttpResponse res = h.send(req);
System.debug('Response Status: ' + res.ToString());
System.debug('Response Body: ' + res.getBody());
Hi eacr
Not possible if you use rssandbox** because that should go through SAML Based Authentication.You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Yoganda. I tried with 'sandbox', also tried with 'www' in production. Same message.
eusb doesn't find the domain but that's ok, we don't have eusb.
Tried matching the partner API version with the one used by the admin account, the latest and the one generated with the code above and no luck.
Regards.
User | Count |
---|---|
8 | |
5 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.