/// <summary> /// Gets the list of offices and 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> /// <returns>The tuple of office and form group lists</returns> public static (OfficeSummaryList offices, FormGroupSummaryList formGroups) GetOfficesAndFormGroups( string basePath, string accessToken, string accountId) { // Construct your API headers var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); var officesApi = new OfficesApi(apiClient); var formGroupsApi = new FormGroupsApi(apiClient); // Call the Rooms API to get offices var offices = officesApi.GetOffices(accountId); // Call the Rooms API to get form groups var formGroups = formGroupsApi.GetFormGroups(accountId); return(offices, formGroups); }
public override IActionResult Get() { base.Get(); string accessToken = RequestItemsService.User.AccessToken; 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 officesApi = new OfficesApi(apiClient); var formGroupsApi = new FormGroupsApi(apiClient); string accountId = RequestItemsService.Session.AccountId; try { // Step 3 start var offices = officesApi.GetOffices(accountId); // Step 3 end // Step 4 start var formGroups = formGroupsApi.GetFormGroups(accountId); // Step 4 end OfficeAccessModel = new OfficeAccessModel { Offices = offices.OfficeSummaries, FormGroups = formGroups.FormGroups }; return(View("Eg08", this)); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }