Search code examples
c#autodesk-forgeautodesk-model-derivative

Download Autodesk Forge viewables using C#


I'am trying to download the Forge viewables in a C# application, but I'm having trouble downloading the svf file. The following code returns "The requested resource does not exist." If I run the same urn in the node.js extractor example it works fine. I'm not that familiar with using REST api's in C# and is probably missing a header or parameter. I have tried lots of combinations without success. Hopefully someone can point me in the right direction.

var urn = "urn:adsk.viewing:fs.file:<xxxxxURNxxxxxx>/output/0/0.svf";
var client = new RestClient("https://developer.api.autodesk.com");
var request = RestRequest("/derivativeservice/v2/derivatives/{" + urn + "}", Method.GET);
request.AddParameter("Authorization",string.Format("Bearer " + Configuration.Default.AccessToken),ParameterType.HttpHeader);
var result = client.Execute(request);

Solution

  • I think you just need to remove the curly braces from the URL, so use RestRequest("/derivativeservice/v2/derivatives/" + urn, Method.GET);