Issue
I am trying 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 U 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.
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
Solution
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.
Answered By - Inbar Gazit Answer Checked By - Mary Flores (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.