The Revit Server REST API

Let's take a look at the material available for programmatic access to the Revit Server.

This came up in a developer query on automatically extracting data from a Revit model housed there.

The automatic extraction of data requires batch mode opening of a Revit model and launching of a command, for which there is no direct Revit API support.

However, this can be easily worked around using normal batch files to start Revit with a given project file, an add-in implementing OnStartup and OnDocumentOpened event handlers, and possibly the Idling event. The unsupported journaling mechanism may also come in handy, but should and mostly can easily be avoided.

Simply put:

With that in place, we can proceed with the Revit Server question:

Question: Yes, we have built a console application for executing Revit.exe to open the Revit file and extract the data using the add-in we developed. This is working perfectly fine.

Our next goal is to automate the extraction process from the Revit Server standpoint.

In out current scenario, we have Revit Server and Revit Client running in multiple locations with 50-75 users, all updating their Revit files to the server.

Question 1: How can I determine which models have been modified or updated in Revit Server. Can the Revit Server API provide this information? We obviously only want to extract the data from modified models.

Question 2: Where do I locate the RVT project files in the Revit Server? When working in Revit I see a folder structure like this:

Miniscule RVT file

Please note the miniscule file size of the highlighted Model.rvt, which is just 1 KB.

If I try open this file in Revit MEP, it fails and throws an exception.

Answer: Congratulations on completing your command line tool for driving Revit and automatically extracting the required data.

Regarding the Revit Server API, I presented some basic information and a sample application making use of the Revit Server REST API back in 2011, followed by a discussion on how to use it to copy a model from a Revit Server. The Revit Server API has not changed since then.

You might want to start off by looking at the user interface tools for managing Revit Server to get an idea of how the system works.

My colleague Adam Nagy presented the Revit Server REST API at DevCamp using this slide deck, Revit Server API.pdf, which focuses mainly on the REST API aspect in general and includes several useful pointers to further information at the end.

All further documentation and samples are provided in the Revit Server SDK, which is part of and lives in its own sub-folder of the standard Revit SDK.

You can also find a number of further examples on the Internet by googling for 'revit server rest api', e.g.: