/// <summary> /// Adds form to specified room /// </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> /// <param name="formId">The Id of a specified form</param> /// <returns>RoomDocument</returns> public static RoomDocument AddForm( string basePath, string accessToken, string accountId, int roomId, Guid formId) { // 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.AddFormToRoom(accountId, roomId, new FormForAdd(formId))); }
public ActionResult ExportData(RoomFormModel roomFormModel) { // 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 add form to a room RoomDocument roomDocument = roomsApi.AddFormToRoom( accountId, roomFormModel.RoomId, new FormForAdd(roomFormModel.FormId)); ViewBag.h1 = "The form was successfully added to a room"; ViewBag.message = $"Results from the Rooms: AddFormToRoom method. RoomId: {roomFormModel.RoomId}, FormId: {roomFormModel.FormId} :"; ViewBag.Locals.Json = JsonConvert.SerializeObject(roomDocument, Formatting.Indented); return(View("example_done")); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }