问题
I promoted integrator key from demo account (Jeff.Zhu@global.com) to live account (accounts@ininin.com) already.
I programmed this way for demo:
$username = "Jeff.Zhu@global.com";
$password = "Pass2009";
$host = "https://demo.docusign.net/restapi";
$integrator_key = "4e8b9e67-8702-4e45-86de-f392fd5f19e2";
// create a new DocuSign configuration and assign host and header(s)
$config = new DocuSign\eSign\Configuration();
$config->setHost($host);
$config->addDefaultHeader("X-DocuSign-Authentication", "{\"Username\":\"" . $username . "\",\"Password\":\"" . $password . "\",\"IntegratorKey\":\"" . $integrator_key . "\"}");
after going live, I change login as follows:
$username = "accounts@ininin.com";
$password = "Pass2009";
$host = "https://www.docusign.net/restapi";
But my program failed after I made such change, so what's wrong?
Please help me out.
I was told to use baseUrl, but there is no baseUrl in my program.
Please help me out.
thanks a lot
回答1:
The steps are:
1) POST to the API's login_information endpoint once to get the baseUrl for the account.
2) For every subsequent request (sending envelopes, checking status, etc.) use that returned baseUrl (after parsing it so it looks like "https://na2.docusign.net/restapi").
So, again:
1) Login to get baseUrl
2) Use new baseUrl for every non-login call (sending envelopes, etc.)
For your PHP code, you have the first part done (making the login call). You need to parse the response to get the baseUrl, and then re-run the $config->setHost($host)
line with the correct baseUrl.
The reason that your code breaks in Live/production is that the demo accounts all run on demo.docusign.com, while Live accounts can run on different baseUrls (na1, na2, eu1, etc.).
For a working example, see https://github.com/docusign/docusign-php-client#usage and notice how there are two $config->setHost($host)
calls.
来源:https://stackoverflow.com/questions/43749389/docusign-what-to-set-host-variable-when-going-live-i-do-not-know-how-to-use-bas