Lab3 View and Data API Web Intro

(This is a continuation from the previous post: Lab2 “View and Data API Intro”)

In the previous lab, we wrote a desktop client application that can upload a file to A360 storage. Those functions we wrote to make REST calls can be easily included in your authoring tools, such as Revit and AutoCAD. Next, we write a simple ASP.NET web application. For now, we keep the basic functionality same as Lab2 (i.e., authenticate, create a bucket, upload a file, and register) as a way to compare differences. Later on in the Lab4, we will add JavaScript layer to embed a viewer.

The good news is that we have written the functions to make the View and Data web services REST calls in a way that we can simply reuse them. In the sample project, we put the common View and Data REST calls under ViewData folder. You can simply copy the folder to your web application if you have followed lab1 and 2.

2015_0310_Lab3ViewDataAPIWebIntro_SolutionWiondow

Instead of Win Form, we use Web Form when we choose a project in Microsoft Visual Studio (MSVS). For this exercise, a simple single web page will be enough. MSVS ASP.NET development environment provides you a set of tools that is analogous to win forms tools. If you have been programming a windows application using Visual Studio, it will look familiar to you.

Difference is, of course, the UI is a web page. A web page in ASP.NET has an extension “aspx”. ASP.NET tools starts with “asp:” in a web form. A code behind an aspx page has an extension “aspx.cs”. In the corresponding code, most of the implementation is analogous to the Win Forms. Only difference is that to save values between different REST calls, we use HttpContext.Current.Session object instead of using a member variable, e.g.,

    // Save authToken for this session

    Session[“authToken”] = authToken;

    // Retrieve authToken for this session

    string accessToken = Session[“authToken”] as string;

 

Image below shows an example of how an application might look.

2015_0310_Lab3ViewDataAPIWebIntro_UI

You can download the View and Data API Intro Labs code from here.

Next: Lab4 “View and Data API Web Intro JS”

Mikako

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s