Message 1 of 4
Revit Server API - Thumbnails
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a Revit Server App on the go and part of it is retrieving thumbnails of the models held on the servers. The Revit Server 2013 API Reference does give a brief explanation of the thumbnail query on page 20 but falls short of giving a code example. So reading through some of the more general REST forums I came up with the code below specifically on how to extract the Image from the response. But it Errors out on the commented line. Anyone any sample code or ideas why it might be erroring? Other types of query (contents, directoryInfo, etc) work OK.
Cheers
Graham
// Create request (model in root folder MyModels/Sector) WebRequest request = WebRequest.Create(
"http://serverName/RevitServerAdminRESTService2013/
AdminRESTService.svc/MyModels|Sector|model01.rvt/t...");
request.Method = "GET"; // Add the request headers request.Headers.Add("User-Name", "Test"); request.Headers.Add("User-Machine-Name", "Test-PC") request.Headers.Add("Operation-GUID", Guid.NewGuid().ToString()); // Read the response // Next line fails // Error 500 Internal Server Error - The server encountered an unexpected condition which
// prevented it from fulfilling the request. WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
return new Bitmap(stream);