public ActionResult ExportData(RoomsListModel model) { // 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); string accountId = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID} try { // Step 3: Call the Rooms API to get room field data FieldData fieldData = roomsApi.GetRoomFieldData(accountId, model.RoomId); ViewBag.h1 = "The room data was successfully exported"; ViewBag.message = $"Results from the Rooms::GetRoomFieldData method RoomId: {model.RoomId} :"; ViewBag.Locals.Json = JsonConvert.SerializeObject(fieldData, Formatting.Indented); return(View("example_done")); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }
/// <summary> /// Gets the specified room's field data /// </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="roomId">The Id of a specified room</param> /// <returns>The specified room's field data</returns> public static FieldData Export( string basePath, string accessToken, string accountId, int roomId) { // Construct your API headers var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", $"Bearer {accessToken}"); var roomsApi = new RoomsApi(apiClient); // Call the Rooms API to get room field data return(roomsApi.GetRoomFieldData(accountId, roomId)); }