Revit REST API: Building as a Service

21 Jan

I have written a few posts on Revit and Databases: Revit DB Link pluginModifying Revit Data through the Web and  Linking a Revit DB to a QR Code.  I also wrote a post on the idea of downloading a building.  As I have been doing more coding, a mashup of these posts has finally hit me. I can download a building through the web and I can do it by creating a REST API on top of a Revit model exported to a database. This post will demonstrate a simple Building API using Revit.


I am going to use a RESTish API. I use the -ish because there is no real specific for REST but rather guidelines. The way it works is you submit a get, post, delete or put request and get a JSON response. For this example I am going to hack together two endpoints: getWalls and editWalls. They will be located at http://localhost:8081/revitAPI/getWalls and http://localhost:8081/revitAPI/editWalls.


When we hit the endpoint for getWalls, we want to have all the wall information returned as JSON. In this example, I will return the id and comments only. The page returns:

[{“id”:184159,”comments”:””},{“id”:184183,”comments”:””},{“id”:184205,”comments”:”Paul-NewestNewest-Comment”},{“id”:184237,”comments”:””},{“id”:184261,”comments”:””},{“id”:184290,”comments”:””},{“id”:184337,”comments”:”My Other Wall”},{“id”:184406,”comments”:”My Wall”},{“id”:184441,”comments”:””},{“id”:184476,”comments”:””},{“id”:999999,”comments”:”999999″}]


editWalls takes two parameters: id and comment. Passing a valid wall id and a comment will result in the Revit Database being changed to reflect the new comment. If successful, the endpoint will return:


Putting it Together

Now I have two RESTish endpoints. What do we do with them? Below is a simple webpage that edits and retrieves the wall table from Revit.



Clicking get walls returns a list of walls.

Wall Schedule. Notice the Badge Displays the Number of Results.

Wall Schedule. Notice the Badge Displays the Number of Results.


The edit walls menu allows you to put text in the box and it will return the wall schedule with the value of wall 184205 changed.

Paul Comment was added

Paul Comment was added

I can then open Revit and see the changes after loading the DBLink plugin.



While this post seems similar to my post on modifying Revit data through the web, you are correct, but there is one fundamental difference – the model can now be queried. In my earlier posts, I only went one way- web to Revit. In this post, the model can talk to us and tell us what is in it – Revit to web. While I only displayed a table of results, you could query by height, area, sort, filter, or perform a whole host of operations on the results of the getWalls endpoint. Furthermore, you now have the ability to make the data public. Anyone could write a webpage analyzing your building data and if you do not allow edit capabilities, there is absolutely no risk to your model.

Note To Architects: If you designed a single front end to a Revit REST API, you would only need to change the urls to ship it to every client you have a BIM for. Write once, sell multiple times. As an architect, why stop making money when the building is complete? Why not get in on the facility management side and make money for the life of the building?


One Response to “Revit REST API: Building as a Service”

  1. dineshramitc March 9, 2015 at 2:37 am #

    Reblogged this on Dinesh Ram Kali..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: