/// <summary>
        /// Creates external form fill session
        /// </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="documentId">The Id of a specified document</param>
        /// <param name="roomId">The Id of a specified room</param>
        /// <returns>ExternalFormFillSession</returns>
        public static ExternalFormFillSession CreateSession(
            string basePath,
            string accessToken,
            string accountId,
            ExternalFormFillSessionForCreate sessionForCreate)
        {
            // Construct your API headers
            var apiClient = new ApiClient(basePath);

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

            // Call the Rooms API to create external form fill session
            var url = externalFormFillSessionsApi.CreateExternalFormFillSession(accountId, sessionForCreate);

            return(url);
        }
        public ActionResult ExportData(RoomDocumentModel roomDocumentModel)
        {
            // Step 1. Obtain your OAuth token
            string accessToken = RequestItemsService.User.AccessToken;                      // Represents your {ACCESS_TOKEN}
            var    basePath    = $"{RequestItemsService.Session.RoomsApiBasePath}/restapi"; // Base API path

            // Step 2: Construct your API headers
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
            var roomsApi = new RoomsApi(apiClient);
            var externalFormFillSessionsApi = new ExternalFormFillSessionsApi(apiClient);

            string accountId = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID}

            try
            {
                // Step 3: Call the Rooms API to create external form fill session
                ExternalFormFillSession url = externalFormFillSessionsApi.CreateExternalFormFillSession(
                    accountId,
                    new ExternalFormFillSessionForCreate(roomDocumentModel.DocumentId.ToString(), roomDocumentModel.RoomId));

                ViewBag.h1          = "External form fill sessions was successfully created";
                ViewBag.message     = $"To fill the form, navigate following URL: <a href='{url.Url}' target='_blank'>Fill the form</a>";
                ViewBag.Locals.Json = JsonConvert.SerializeObject(url, Formatting.Indented);

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

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