Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2011 Autodesk Automating Autodesk® Revit® Server Rod Howarth Software Development Manager – Bornhorst + Ward.

Similar presentations


Presentation on theme: "© 2011 Autodesk Automating Autodesk® Revit® Server Rod Howarth Software Development Manager – Bornhorst + Ward."— Presentation transcript:

1 © 2011 Autodesk Automating Autodesk® Revit® Server Rod Howarth Software Development Manager – Bornhorst + Ward

2 © 2011 Autodesk Class Summary This class will explore the API’s that are exposed by Autodesk Revit Server and how we can make use of them in some interesting applications.

3 © 2011 Autodesk Learning Objectives At the end of this class, you will be able to:  Explain how Revit server automation can be integrated into existing software processes  Describe the REST interface to Revit Server  Combine the Revit Server command line and the Revit API to perform a task in a Revit model on a schedule  Use the supplied command line utility to create local files from Revit Server

4 © 2011 Autodesk Agenda  Revit Server Background  REST API Overview  Intro  What is REST?  How to access it  Rest API overview  What can I use it for?  HTML Server Admin  Interface with existing system  Revit Server Command Line Tools  Creating local files  Opportunities

5 © 2011 Autodesk Revit Server Background

6 © 2011 Autodesk Revit Server Background  Young product  Replaces file system storage of central files  Optimizes network traffic  Allows replication  Hosted in IIS  Web based administration tool

7 © 2011 Autodesk Admin Tool

8 © 2011 Autodesk REST API Overview

9 © 2011 Autodesk Revit Server API – What is it?  Allows administration of folders and models  Exposes the functionality from the online admin tool  User guide available in the Revit SDK  Web based API  Uses REST

10 © 2011 Autodesk What is REST?  Representational State Transfer (REST)  Web based API that uses URLs to interact  Based on HTTP specification  Browsers access websites in the same way  Uses HTTP Verbs  GET - Read only retrieval of a resource  POST – Modify/update a resource  PUT – Create/Overwrite a resource  DELETE - Delete a resource

11 © 2011 Autodesk What is a resource?  A resource is identified by a URL (Uniform Resource Locator)  Browsers request a ‘resource’ from a web server (usually GET requests)  Verbs and query string define what to do to this resource  Querystring is the ?parameter=value&parameter2=value  Server responds with response code and data  404 is a HTTP response code for resource not found  200 is the code for success

12 © 2011 Autodesk Anatomy of a HTTP request GET http://usa.autodesk.com/company/ HTTP/1.1 Header: value Header2: value2 Host Name Resource Protocol Verb Header list HTTP Version

13 © 2011 Autodesk Anatomy of a HTTP Response HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Header: Value Header2: Value2 About Autodesk We are a software company that make Revit Content Type Raw Data Response Code Header list Data can be HTML, JSON, XML, Binary or other formats

14 © 2011 Autodesk REST APIs  URL and the Verb combine to act as a sort of method call  URL identifies what you what resource you are using  Verb specifies what action to take  Same URL with different verbs can be totally different  GET http://servername/resource returns the resourcehttp://servername/resource  DELETE http://servername/resource deletes ithttp://servername/resource  Big difference!  Querystring can be used to supply extra parameters  DELETE http://servername/resource?newObjectName=newName could rename to newNamehttp://servername/resource?newObjectName=newName  Leave out Querystring to delete

15 © 2011 Autodesk How to access REST services  Standard HTTP request  Use anything capable of HTTP requests  C# and VB have System.Net.HttpWebRequest  Jquery(Javascript) has $.ajax()

16 © 2011 Autodesk Why REST?  Many advantages  Hosted on a web server  Use them with any programming language capable of a web request  Consistent and self describing interface  Very popular on the web  Flickr is well known for having a good REST API

17 © 2011 Autodesk More on REST Further Resources  Nettuts+ - http://goo.gl/EHxmHhttp://goo.gl/EHxmH  O’Reilly RESTful Web Services Book - http://goo.gl/NiuAhhttp://goo.gl/NiuAh  Probably more for people making RESTful API’s View HTTP requests  Firebug in Firefox  F12 in Chrome and IE then click ‘Network’  Fiddler2 (http://fiddler2.com) lets you view ALL request on your systemhttp://fiddler2.com  Very useful for testing your Revit Server API access

18 © 2011 Autodesk JSON  JavaScript Object Notation  Alternative to XML/HTML for displaying data  Easy to use with Jquery  Requires parsing in.NET { "Path": string, "Items": [ { "Comment": string, "Date": DateTime, "User": string, "VersionNumber": int, "ModelSize": int } ] }

19 © 2011 Autodesk The Revit Server REST API  Specification in SDK  Base URL: http://servername/RevitServerAdminRESTService/AdminRESTService.svc http://servername/RevitServerAdminRESTService/AdminRESTService.svc  Required headers to identify yourself when making requests  Information Querying APIs  Get server properties, folder contents, directory info, model save history  Data Managing APIs  Lock models/folders, delete locks  Create, delete, move, rename and copy folders/models

20 © 2011 Autodesk Quick Examples  GET /{folderPath}/contents  Returns a JSON object listing the models and folders  For example GET http://BASEURL/AUJob/contents  To get the contents of the parent dir use a space GET http://baseurl/ /contents  PUT /{objectPath}/lock  Locks the specified folder or model (object can be either)  For example PUT /AUJob|Subfolder|Model_01.rvt/lock  Notice that | is used instead of the familiar / in the path  This is because the / would form part of the URL

21 © 2011 Autodesk What can I use it for?

22 © 2011 Autodesk HTML Server Admin  Existing interface is Silverlight based  This is ok, but requires installation and won’t work on mobile  Revit Server API gives us same functionality  We can use this API to build a HTML replica  With a little help from JQuery

23 © 2011 Autodesk Demo

24 © 2011 Autodesk Interface with existing system  A more likely scenario is linking with an existing system  For example, a project records system  User enters project details, and it is stored in a database  Want to make a Revit Server folder automatically for new projects

25 © 2011 Autodesk Demo

26 © 2011 Autodesk Revit Server Command Line Utilities

27 © 2011 Autodesk Revit Server Command Line Utilities  2 similarly named utilities  RevitServerCommand  Allows you to lock/unlock models/folders  Already seen 2 other ways of doing this  Ships in Revit Server folder  RevitServerToolCommand  Ships in the Revit Directory on all users PC’s  Lets you create local files from a Revit Server

28 © 2011 Autodesk RevitServerToolCommand  Create local files  Located under Revit Dir  Program\RevitServerToolCommand

29 © 2011 Autodesk Opportunities

30 © 2011 Autodesk Opportunities  Already seen some potential use cases, but more to ponder…  Revit Server has all of your files stored on your servers  This data is replicated automatically to all locations  Quick access to Revit files on any Revit Server  Ability to lock and unlock files

31 © 2011 Autodesk Revit Remote Boot  Last example of what you could do with these API’s  This tool lets you run some code on a model at scheduled times  Very fragile, prototype only  (Revit isn’t meant for this kind of thing)  May give you ideas for your own tools

32 © 2011 Autodesk Demo

33 © 2011 Autodesk Conclusion  Revit Server is still a young product  But already has a great API  REST lets you access from anywhere  Command line tools provide even more access  Plenty of things you could make  Contact me via rodhowarth257@gmail.com or twitter.com/rodh257rodhowarth257@gmail.com

34 © 2011 Autodesk Autodesk, AutoCAD* [*if/when mentioned in the pertinent material, followed by an alphabetical list of all other trademarks mentioned in the material] are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. Autodesk reserves the right to alter product and services offerings, and specifications and pricing at any time without notice, and is not responsible for typographical or graphical errors that may appear in this document. © 2011 Autodesk, Inc. All rights reserved.


Download ppt "© 2011 Autodesk Automating Autodesk® Revit® Server Rod Howarth Software Development Manager – Bornhorst + Ward."

Similar presentations


Ads by Google