Salesforce 通过apex登录到Docusign API
我正在尝试从Salesforce开发者控制台进行“登录信息”调用,以连接到Docusign REST API,但出现问题: '提供的URL未解析为资源' 这是我的密码:Salesforce 通过apex登录到Docusign API,salesforce,apex,docusignapi,Salesforce,Apex,Docusignapi,我正在尝试从Salesforce开发者控制台进行“登录信息”调用,以连接到Docusign REST API,但出现问题: '提供的URL未解析为资源' 这是我的密码: private static final string TOKEN_URL = 'https://demo.docusign.net/restapi/v2/login_information'; private static final string userName = 'username'; private static f
private static final string TOKEN_URL = 'https://demo.docusign.net/restapi/v2/login_information';
private static final string userName = 'username';
private static final string password = 'password';
private static final string integrationKey = 'integrationKey';
string authenticationHeader =
'<DocuSignCredentials>' +
'<Username>' + userName+ '</Username>' +
'<Password>' + password + '</Password>' +
'<IntegratorKey>' + integrationKey + '</IntegratorKey>' +
'</DocuSignCredentials>';
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint(TOKEN_URL);
req.setHeader('Content-Type', 'application/json');
req.setHeader('Accept', 'application/json');
req.setHeader('X-DocuSign-Authentication', authenticationHeader);
req.setMethod('GET');
req.setBody('');
res = http.send(req);
private静态最终字符串标记\u URL='1〕https://demo.docusign.net/restapi/v2/login_information';
私有静态最终字符串userName='userName';
私有静态最终字符串密码='password';
私有静态最终字符串integrationKey='integrationKey';
字符串authenticationHeader=
'' +
''+用户名+''+
''+密码+''+
''+integrationKey+''+
'';
HttpRequest req=新的HttpRequest();
HttpResponse res=新的HttpResponse();
Http=newhttp();
请求setEndpoint(令牌\ URL);
req.setHeader('Content-Type','application/json');
请求setHeader('Accept','application/json');
请求setHeader('X-DocuSign-Authentication',authenticationHeader);
请求setMethod('GET');
要求立根体(“”);
res=http.send(req);
我可以使用我的凭据登录到Docusign控制台,所以一切都是正确的。但是不能通过Apex做同样的事情。可能是因为没有权限吗 要求立根体(“”);应该从代码中删除。它解决了这个问题。我看不出上面的URL有什么问题。我不是顶尖大师,所以不确定你的SF权限或访问是否有问题。你能打电话给任何其他外部服务吗?您使用的是哪种类型的SF帐户,开发人员沙箱帐户还是生产帐户?另外,不确定是否相关,但我看到的一个问题是,您正在将内容类型设置为JSON,但提供XML格式的auth头。您应该改用JSON格式的auth头。请参阅本页的中间部分,了解它是什么样子的:Ergin,似乎无论我使用什么格式—XML或JSON,结果都是相同的—404错误。我在sandbox中工作,我曾经使用ZuoraAPI,没有任何问题。问题解决了!本:要求设置正文(“”);应该从代码中删除。很高兴你解决了这个问题!为了社区的利益,你能回答自己的问题吗?如果没有,我可以发布它。。。我需要等到明天才能回答。我会的。谢谢你的支持。