I am try to call DocuSign to create the envelope in production and i am getting error as
Error calling CreateEnvelope: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid URL</h2>
<hr><p>HTTP Error 400. The request URL is invalid.</p>
</BODY></HTML>
Code to call envelope
Dim accessToken = AccessToken1 ' Access token using JWT
Dim basePath = BasePath1 ' https://eu.docusign.net/restapi
Dim accountId = AccountId1 ' AccountId1 from production login
Dim env As EnvelopeDefinition = MakeEnvelope(Signer, DocusignCcAddress, Buffer, FileName)
Dim apiClient = New ApiClient(basePath)
apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " & accessToken)
Dim envelopesApi As EnvelopesApi = New EnvelopesApi(apiClient)
Dim results As EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, env) ' here i get that error
Return results
When i use basepath url as "https://docusign.net/restapi" i am getting this error "Error calling CreateEnvelope: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."
For ur reference i used following code to get Access token successfully
Dim apiClient = New ApiClient("https://eu.docusign.net/restapi")
Dim ik As String = odjDTRep.Rows(0)("iss_Int_Key").ToString()
Dim userId As String = odjDTRep.Rows(0)("sub1_Api_UserName").ToString()
Dim authserver As String = odjDTRep.Rows(0)("aud").ToString()
Dim rsaKey As String = System.IO.File.ReadAllText(Server.MapPath("") & "/Key/KMKey.key")
Dim scopes = New List(Of String) From {
"signature"
}
Dim authToken As OAuth.OAuthToken = apiClient.RequestJWTUserToken(ik, userId, authserver, Encoding.UTF8.GetBytes(rsaKey), 1, scopes)
Dim accessToken As String = authToken.access_token
Pls help to solve asap
Regards and Thanks Aravind
CodePudding user response:
You need to set the baseURL for your production account. It is not the same for all customers, so you have to retrieve it using getUserInformation() command.
You can also find your baseURL on the Apps and Keys page if you go there at the top.