/// <summary> /// Creates a new clickwrap /// </summary> /// <param name="name">The name of new clickwrap</param> /// <param name="basePath">BasePath for API calls (URI)</param> /// <param name="accessToken">Access Token for API call (OAuth)</param> /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param> /// <returns>The summary response of a newly created clickwrap</returns> public static ClickwrapVersionSummaryResponse Create(string name, string basePath, string accessToken, string accountId) { var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); var clickAccountApi = new AccountsApi(apiClient); var clickwrapRequest = BuildClickwraprequest(name); return(clickAccountApi.CreateClickwrap(accountId, clickwrapRequest)); }
public ActionResult Create(string name) { // Step 1. Obtain your OAuth token var accessToken = RequestItemsService.User.AccessToken; var basePath = $"{RequestItemsService.Session.BasePath}/clickapi"; // Base API path // Step 2: Construct your API headers var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); var clickAccountApi = new AccountsApi(apiClient); var accountId = RequestItemsService.Session.AccountId; try { // Step 3: Construct the request body for your clickwrap ClickwrapRequest clickwrapRequest = BuildClickwraprequest(name); // Step 4: Call the Click API to create a clickwrap var clickWrap = clickAccountApi.CreateClickwrap(accountId, clickwrapRequest); //Show results ViewBag.h1 = "The clickwrap was successfully created"; ViewBag.message = $"The clickwrap was created! Clickwrap ID: {clickWrap.ClickwrapId}, Name: {clickWrap.ClickwrapName}."; ViewBag.Locals.Json = JsonConvert.SerializeObject(clickWrap, Formatting.Indented); // Save for future use within the example launcher RequestItemsService.ClickwrapId = clickWrap.ClickwrapId; return(View("example_done")); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }