コード例 #1
0
        /// <summary>
        /// Creates form group
        /// </summary>
        /// <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>
        /// <param name="groupName">The name of new group</param>
        /// <returns>The new form group</returns>
        public static FormGroup CreateGroup(
            string basePath,
            string accessToken,
            string accountId,
            string groupName)
        {
            // Construct your API headers
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", $"Bearer {accessToken}");
            var formGroupsApi = new FormGroupsApi(apiClient);

            var formGroupForCreate = new FormGroupForCreate(groupName);

            // Call the Rooms API to create form group
            return(formGroupsApi.CreateFormGroup(accountId, formGroupForCreate));
        }
コード例 #2
0
        public ActionResult CreateFormGroup(FormGroupModel formGroupModel)
        {
            string accessToken = RequestItemsService.User.AccessToken;                      // Represents your {ACCESS_TOKEN}
            var    basePath    = $"{RequestItemsService.Session.RoomsApiBasePath}/restapi"; // Base API path

            // Step 2 start
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
            // Step 2 end

            var    formGroupsApi = new FormGroupsApi(apiClient);
            string accountId     = RequestItemsService.Session.AccountId;

            try
            {
                // Step 3 start
                var formGroupForCreate = new FormGroupForCreate(formGroupModel.Name);
                // Step 3 end

                // Step 4 start
                FormGroup formGroup = formGroupsApi.CreateFormGroup(accountId, formGroupForCreate);
                // Step 4 end

                ViewBag.h1          = "The form group was successfully created";
                ViewBag.message     = $"The form group was successfully created, FormGroupId: '{formGroup.FormGroupId}'";
                ViewBag.Locals.Json = JsonConvert.SerializeObject(formGroup, Formatting.Indented);

                return(View("example_done"));
            }
            catch (ApiException apiException)
            {
                ViewBag.errorCode    = apiException.ErrorCode;
                ViewBag.errorMessage = apiException.Message;

                return(View("Error"));
            }
        }