Ejemplo n.º 1
0
        /// <summary>
        /// Deletes a permission profile
        /// </summary>
        /// <param name="permissionProfileId">Permission profile ID</param>
        /// <param name="accessToken">Access Token for API call (OAuth)</param>
        /// <param name="basePath">BasePath for API calls (URI)</param>
        /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param>
        public static void DeletePermissionProfile(string permissionProfileId, string accessToken, string basePath, string accountId)
        {
            // Construct your API headers
            var config = new Configuration(new ApiClient(basePath));

            config.AddDefaultHeader("Authorization", "Bearer " + accessToken);
            AccountsApi accountsApi = new AccountsApi(config);

            // Call the eSignature REST API
            accountsApi.DeletePermissionProfile(accountId, permissionProfileId);
        }
Ejemplo n.º 2
0
        public IActionResult Delete(string permissionProfileId)
        {
            // Check the minimal buffer time.
            bool tokenOk = CheckToken(3);

            if (!tokenOk)
            {
                // We could store the parameters of the requested operation so it could be
                // restarted automatically. But since it should be rare to have a token issue
                // here, we'll make the user re-enter the form data after authentication.
                RequestItemsService.EgName = EgName;
                return(Redirect("/ds/mustAuthenticate"));
            }

            // Uri of rest api
            var basePath = RequestItemsService.Session.BasePath + "/restapi";

            // Step 1: Obtain your OAuth token
            var accessToken = RequestItemsService.User.AccessToken;  // Represents your {ACCESS_TOKEN}
            var accountId   = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID}

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

            config.AddDefaultHeader("Authorization", "Bearer " + accessToken);
            AccountsApi accountsApi = new AccountsApi(config);

            try
            {
                //Step 3. Call the eSignature REST API
                accountsApi.DeletePermissionProfile(accountId, permissionProfileId);
            }
            catch (ApiException ex)
            {
                //Request failed. Display error text
                ViewBag.h1      = "The permission profile failed to delete";
                ViewBag.message = $"The permission profile failed to delete.<br /> Reason: <br />{ex.ErrorContent}";
                return(View("example_done"));
            }

            ViewBag.h1      = "The permission profile is deleted";
            ViewBag.message = "The permission profile is deleted!";
            return(View("example_done"));
        }