Skip to content

View models from listof buckets and objects: This basic C# WebAPI back-end sample implements a basic list of Buckets and Objects with an Autodesk Forge 2-Legged Token

License

Notifications You must be signed in to change notification settings

vivenci/model.derivative-WebAPI-sample

 
 

Repository files navigation

model.derivative-csharp.webapi-viewer.sample

Platforms .NET ASP.NET License

oAuth2 Data-Management OSS Model-Derivative Viewer

Description

This basic C# WebAPI back-end sample implements a basic list of Buckets and Objects with an Autodesk Forge 2 Legged OAuth. The front-end was desiged with pure HTML + JavaScript (jQuery, Bootstrap), no ASPx features (i.e. no WebForms or MVC on this sample). It should look like:

thumbnail

The Visual Studio solution includes 1 project:

1. ASPNET.Webapi: WebAPI backend that expose specific endpoints to the fron-end (pude HTML + JavaScript) via Controllers.

Live demo

Try it live at modelderivative.apphb.com (hosted by AppHarbor). Important: this sample is public, therefore any file uploaded will be visible to others.

Setup

For using this sample, you need an Autodesk developer credentials. Visit the Forge Developer Portal, sign up for an account, then create an app that uses Data Management and Model Derivative APIs. For this new app, use http://localhost:3000/api/forge/callback/oauth as Callback URL, although is not used on 2-legged flow. Finally take note of the Client ID and Client Secret.

Run Locally

Open the web.config file and adjust the Forge Client ID & Secret. If you plan to deploy to Appharbor, configure the variables (no need to change this web.config file).

<appSettings>
  <add key="FORGE_CLIENT_ID" value="" />
  <add key="FORGE_CLIENT_SECRET" value="" />
</appSettings>

Compile the solution, Visual Studio should download the NUGET packages (Autodesk Forge, RestSharp and Newtonsoft.Json)

Start the ASPNET.webapi project, the index.html is marked as start page. At the webpage, the New Bucket blue button allow create new buckets (as of now, minimum input validation is implemented). For any bucket, right-click to upload a file (objects). For demonstration, objects are not automatically translated, but right-click on a object and select Translate. If is a .ZIP file, it will request to type the root file.

Deployment

For Appharbor deployment, following this steps to configure your Forge Client ID & Secret.

Known issues

The ASPNET.webapi project is adding reference to Newtonsoft.Json library due a dependency from another library (jsTree), but this is not required and cause a conflict of versions. If it happens, you can safely remove this reference (from ASPNET.webapi project).

License

This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Augusto Goncalves @augustomaia, Forge Partner Development

About

View models from listof buckets and objects: This basic C# WebAPI back-end sample implements a basic list of Buckets and Objects with an Autodesk Forge 2-Legged Token

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 78.0%
  • HTML 21.6%
  • Classic ASP 0.4%