Getting Started With Revit Server REST API
Getting Started With Revit Server REST API
This document gives you a brief overview of what is involved in using Revit Server REST API. We have created a sample application as a means of demonstrating the usage. Please locate the following sample accompanying this document and ta!e a loo! at it while reading this document"
Resources 'ou can find the detailed full documentation about the Revit Server REST API under the Revit S() folder"
If you are new to REST you may find the following article helpful to learn about REST"
We assume you are familiar with the .-ET API and understand the basic idea of REST. (escription 'ou can create .ttp Re,uests in .-ET in various ways. .ere we use System.-et.WebRe,uest for this" -ote" in case of Revit Server /012 use RevitServerAdminRESTService2013 instead of RevitServerAdminRESTService in the re,uest string
WebRequest request = WebRequest.Create( " http://<host>/RevitServerAdminRESTService2013/AdminRESTService.svc ");
'ou simply have to specify the 3RI address that the re,uest is targeting. Then you can specify the type of re,uest 45ET P3T P6ST etc7.
request.Method = "GET";
As the API reference points out you also need to provide information in the re,uest8s header. 'ou can add the necessary name&value pairs to the re,uest8s header li!e this"
request.Headers.Add("User-Name" "Adam");
'ou also have to add a command string that will specify what information you are re,uesting. 'ou need to append it to the service 3RI with a + in between"
WebRequest.Create("htt!"##$host%#Re&'t(er&erAdm')RE(T(er&'*e+,-.#Adm')RE (T(er&'*e.s&* /serverProperties ");
If you need to get information from a specific folder or file you also need to specify the
path to it with each folder&subfolder separated by a vertical bar character 9. The root folder is represented by 9
WebRequest.Create("htt!"##$host%#Re&'t(er&erAdm')RE(T(er&'*e+,-.#Adm')RE (T(er&'*e.s&* /|Fo der|S!"Fo der|Fi e/histor# ");
(epending on the actual re,uest the result will be different. *ut each time it is organi:ed using the ;son format. 'ou can convert the ;son data to <ml format in .-ET and then read it using =ml(ictionaryReader"
/m01'*t'o)ar2Reader 3so)Reader = 4so)ReaderWr'ter5a*tor2.Create4so)Reader( request.GetRes!o)se().GetRes!o)se(tream() quotas );
>or more information please refer to the Revit Server REST API Reference.pdf.
Written by" Adam -agy (eveloper Technical Services 2+/?+/011 @ast revised" 1+1?+/01/