public ActionResult SendDocumentforSign(Recipient recipient, HttpPostedFileBase UploadDocument) { byte[] fileBytes; using (Stream inputStream = UploadDocument.InputStream) { MemoryStream memoryStream = inputStream as MemoryStream; if (memoryStream == null) { memoryStream = new MemoryStream(); inputStream.CopyTo(memoryStream); } fileBytes = memoryStream.ToArray(); } var DocumentBase64 = System.Convert.ToBase64String(fileBytes); DocuSignRequestData inputModel = new DocuSignRequestData(); inputModel.fileData = DocumentBase64; inputModel.Email = recipient.Email; inputModel.Name = recipient.Name; inputModel.Description = recipient.Description; //Note: be replcaed by actual webhook URL of caller API. inputModel.returnUrl = "http://callerapi.azurewebsites.net/api/SignedDocumentRecvd/ReciveSignedDoc"; using (var client = new HttpClient()) { //var res = await client.PostAsync("https://localhost:44349/api/DocuSignPost/SendDocumentforSign", new StringContent(JsonConvert.SerializeObject(inputModel), Encoding.UTF8, "application/json")); HttpResponseMessage res = client.PostAsync("https://dssapi.azurewebsites.net/api/DocuSignPost/SendDocumentforSign", new StringContent(JsonConvert.SerializeObject(inputModel), Encoding.UTF8, "application/json")).Result; // HttpResponseMessage res = client.PostAsync("https://localhost:44349/api/DocuSignPost/SendDocumentforSign", new StringContent(JsonConvert.SerializeObject(inputModel), Encoding.UTF8, "application/json")).Result; Task <string> responseesult = res.Content.ReadAsStringAsync(); DocuSignResponse obj = JsonConvert.DeserializeObject <DocuSignResponse>(responseesult.Result.ToString()); if (obj != null && !string.IsNullOrEmpty(obj.EnvelopeId)) { ViewBag.SucMessage = "Document sent successully"; } try { res.EnsureSuccessStatusCode(); //res.Result.EnsureSuccessStatusCode(); } catch (Exception e) { Console.WriteLine(e.ToString()); } } return(View()); }
/// <summary> /// Returns Account available seals for specified account. /// </summary> /// <exception cref="DocuSign.eSign.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="accountId">The external account number (int) or account ID Guid.</param> /// <returns>Task of ApiResponse (AccountSeals)</returns> public async System.Threading.Tasks.Task <ApiResponse <AccountSeals> > GetSealProvidersAsyncWithHttpInfo(string accountId) { // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing required parameter 'accountId' when calling TrustServiceProvidersApi->GetSealProviders"); } var localVarPath = "/v2.1/accounts/{accountId}/seals"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new Dictionary <String, String>(); var localVarHeaderParams = new Dictionary <String, String>(this.ApiClient.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new List <FileParameter>(); Object localVarPostBody = null; String localVarHttpContentDisposition = string.Empty; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { }; String localVarHttpContentType = this.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (accountId != null) { localVarPathParams.Add("accountId", this.ApiClient.ParameterToString(accountId)); // path parameter } // authentication (docusignAccessCode) required // oauth required if (!String.IsNullOrEmpty(this.ApiClient.Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + this.ApiClient.Configuration.AccessToken; } // make the HTTP request DocuSignRequest localVarRequest = this.ApiClient.PrepareRequest(localVarPath, HttpMethod.Get, localVarQueryParams.ToList(), localVarPostBody, localVarHeaderParams.ToList(), localVarFormParams.ToList(), localVarPathParams.ToList(), localVarFileParams, localVarHttpContentType, localVarHttpContentDisposition); DocuSignResponse localVarResponse = await this.ApiClient.CallApiAsync(localVarRequest); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("GetSealProviders", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <AccountSeals>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (AccountSeals)this.ApiClient.Deserialize(localVarResponse, typeof(AccountSeals)))); }
/// <summary> /// Retrieves org level report by correlation id and site. /// </summary> /// <exception cref="DocuSign.eSign.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="organizationId"></param> /// <param name="reportCorrelationId"></param> /// <returns>ApiResponse of Object(void)</returns> public ApiResponse <Object> GetReportV2WithHttpInfo(string organizationId, string reportCorrelationId) { // verify the required parameter 'organizationId' is set if (organizationId == null) { throw new ApiException(400, "Missing required parameter 'organizationId' when calling OrganizationsApi->GetReportV2"); } // verify the required parameter 'reportCorrelationId' is set if (reportCorrelationId == null) { throw new ApiException(400, "Missing required parameter 'reportCorrelationId' when calling OrganizationsApi->GetReportV2"); } var localVarPath = "/v2.1/organization_reporting/{organizationId}/reportsv2/{reportCorrelationId}"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new Dictionary <String, String>(); var localVarHeaderParams = new Dictionary <String, String>(this.ApiClient.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new List <FileParameter>(); Object localVarPostBody = null; String localVarHttpContentDisposition = string.Empty; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { }; String localVarHttpContentType = this.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (organizationId != null) { localVarPathParams.Add("organizationId", this.ApiClient.ParameterToString(organizationId)); // path parameter } if (reportCorrelationId != null) { localVarPathParams.Add("reportCorrelationId", this.ApiClient.ParameterToString(reportCorrelationId)); // path parameter } // authentication (docusignAccessCode) required // oauth required if (!String.IsNullOrEmpty(this.ApiClient.Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + this.ApiClient.Configuration.AccessToken; } // make the HTTP request DocuSignRequest localVarRequest = this.ApiClient.PrepareRequest(localVarPath, HttpMethod.Get, localVarQueryParams.ToList(), localVarPostBody, localVarHeaderParams.ToList(), localVarFormParams.ToList(), localVarPathParams.ToList(), localVarFileParams, localVarHttpContentType, localVarHttpContentDisposition); DocuSignResponse localVarResponse = this.ApiClient.CallApi(localVarRequest); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("GetReportV2", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <Object>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), null)); }