RevitServerNet 1.1.2
See the version list below for details.
dotnet add package RevitServerNet --version 1.1.2
NuGet\Install-Package RevitServerNet -Version 1.1.2
<PackageReference Include="RevitServerNet" Version="1.1.2" />
<PackageVersion Include="RevitServerNet" Version="1.1.2" />
<PackageReference Include="RevitServerNet" />
paket add RevitServerNet --version 1.1.2
#r "nuget: RevitServerNet, 1.1.2"
#:package RevitServerNet@1.1.2
#addin nuget:?package=RevitServerNet&version=1.1.2
#tool nuget:?package=RevitServerNet&version=1.1.2
RevitServerNet
A .NET library for working with Revit Server REST API. Provides easy access to Revit Server operations including folder management, project operations, locking, and history tracking.
Features
- Server Management: Get server information and status
- Folder Operations: Create, delete, and manage folders on Revit Server
- Project Management: Handle project operations and metadata
- Locking System: Manage file locks and permissions
- History Tracking: Access project history and version information
- Direct Export: Convert Revit Server models to RVT using RS assemblies (net48)
- Multi-Version Support: Supports Revit Server versions from 2012 to 2026
- Async Operations: All API calls are asynchronous for better performance
Installation
Install-Package RevitServerNet
Or via NuGet Package Manager:
RevitServerNet
Or via .NET CLI:
dotnet add package RevitServerNet
Quick Start
using RevitServerNet;
// Initialize API client
var api = new RevitServerApi("your-server-host", "your-username");
// Get server information
var serverInfo = await api.GetServerInfoAsync();
// List folders
var folders = await api.GetFoldersAsync("/path/to/folder");
Supported Revit Server Versions
- Revit Server 2012-2026
Requirements
- .NET Framework 4.8
- Newtonsoft.Json 13.0.3
Usage Examples
Basic Setup
using RevitServerNet;
// Create API client
var api = new RevitServerApi(
host: "your-revit-server.com",
userName: "your-username",
useHttps: true, // Optional, default: false
serverVersion: "2024" // Optional, default: "2019"
);
Server Operations
// Get server information
var serverInfo = await api.GetServerInfoAsync();
// Get server status
var status = await api.GetServerStatusAsync();
Folder Operations
// List folders in a directory
var folders = await api.GetFoldersAsync("/Projects");
// Create a new folder
await api.CreateFolderAsync("/Projects/NewProject");
// Delete a folder
await api.DeleteFolderAsync("/Projects/OldProject");
Project Operations
// Get project information
var projectInfo = await api.GetProjectInfoAsync("/Projects/MyProject");
// Get project history
var history = await api.GetProjectHistoryAsync("/Projects/MyProject");
Locking Operations
// Lock a file
await api.LockFileAsync("/Projects/MyProject/file.rvt");
// Unlock a file
await api.UnlockFileAsync("/Projects/MyProject/file.rvt");
// Get lock information
var lockInfo = await api.GetLockInfoAsync("/Projects/MyProject/file.rvt");
Direct export from Revit Server (RS Enterprise API)
RevitServerNet can export a model directly to a local RVT file using the RS Enterprise assemblies — without calling RevitServerTool.exe. This works only on .NET Framework 4.8 because Autodesk’s RS libraries target net48.
Prerequisites:
- Windows with .NET Framework 4.8
- Access to the Revit Server host
- RS assemblies for the target version available in
RSAssemblies/<year>(shipped in the repo) or in a custom folder you pass viaAssembliesPath
Minimal net48 example (direct call)
using RevitServerNet;
var options = new ModelExporterOptions
{
ServerHost = "revit-server.local",
ModelPipePath = "|Projects|Demo|Model.rvt", // pipe or Windows-style path
DestinationFile = @"C:\Exports\Demo.rvt",
RevitVersion = "2024",
AssembliesPath = @"C:\path\to\RSAssemblies\2024", // optional: autodetected if bundled folder is present
Overwrite = true
};
var resultPath = await ModelExporter.ExportAsync(
options,
new Progress<long>(bytes => Console.WriteLine($"Downloaded {bytes} bytes"))
);
Console.WriteLine($"Exported to: {resultPath}");
Using RevitServerApi extension (infers host/version)
using RevitServerNet;
using RevitServerNet.Extensions;
var api = new RevitServerApi("revit-server.local", "user", serverVersion: "2024");
await api.ExportModelAsync(
modelPath: "|Projects|Demo|Model.rvt",
destinationFile: @"C:\Exports\Demo.rvt",
overwrite: true
);
Notes:
- The extension infers host/version from
api.BaseUrl. It throwsPlatformNotSupportedExceptionon non-net48 targets. - Use pipe-format paths (
|Projects|...|file.rvt) or Windows-style relative paths (Projects\...\file.rvt).
Reference implementation
See AnlaxRSExportService (net48 WebAPI + CLI) for a working sample that wraps ModelExporter:
- CLI:
AnlaxRSExportService.exe --export <server> <pipePath> <localPath> <revitVersion> [rsAssembliesPath] - HTTP:
POST http://localhost:3074/api/export/exportwith JSON matchingModelExporterOptionsfields.
API Reference
RevitServerApi Class
Main class for interacting with Revit Server REST API.
Constructor
public RevitServerApi(string host, string userName, bool useHttps = false, string serverVersion = "2019")
Properties
BaseUrl: Gets the base URL for API requestsUserName: Gets the user name used for API requests
Methods
GetAsync(string command, Dictionary<string, string> additionalHeaders = null): Performs GET requestPostAsync(string command, string data = null, Dictionary<string, string> additionalHeaders = null): Performs POST requestPutAsync(string command, string data = null, Dictionary<string, string> additionalHeaders = null): Performs PUT requestDeleteAsync(string command, Dictionary<string, string> additionalHeaders = null): Performs DELETE request
Extension Methods
The library provides extension methods for common operations:
ServerExtensions
GetServerInfoAsync(this RevitServerApi api)GetServerStatusAsync(this RevitServerApi api)
FolderExtensions
GetFoldersAsync(this RevitServerApi api, string path)CreateFolderAsync(this RevitServerApi api, string path)DeleteFolderAsync(this RevitServerApi api, string path)
ProjectExtensions
GetProjectInfoAsync(this RevitServerApi api, string path)
HistoryExtensions
GetProjectHistoryAsync(this RevitServerApi api, string path)
LockingExtensions
LockFileAsync(this RevitServerApi api, string path)UnlockFileAsync(this RevitServerApi api, string path)GetLockInfoAsync(this RevitServerApi api, string path)
Error Handling
The library throws RevitServerApiException for API-related errors:
try
{
var folders = await api.GetFoldersAsync("/Projects");
}
catch (RevitServerApiException ex)
{
Console.WriteLine($"API Error: {ex.Message}");
}
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions, please open an issue on the GitHub repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- Newtonsoft.Json (>= 13.0.3)
- System.Security.Permissions (>= 9.0.9)
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
- System.Security.Permissions (>= 9.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Add RevitServerUiApi (Admin UI API) + UI DTO models. Generate AdminRESTService and Admin UI base paths by version (up to 2012 base name, otherwise suffix year).