# Using ComponentOne WebAPI Edition Template

Use the C1 Web API Template to create a new project. Learn more about the C1 Web API Template in MVC documentation.

## Content



If you have installed Web API Edition from C1Studio installer, then it is easy to create a project pre-configured with FlexReport Web API. Use the C1 Web API Template to create a new project named FlexreportWebAPI and follow the steps below:

### Add Report files to Web API Application

Complete the following steps to add report files to your application.

1.  Add a folder named **Files** to your application.
2.  Add the FlexReport's report definition file to it.<br />This example is using the FlexCommonTasks.flxr report definition, which is provided in **FlexViewer HowTo** sample (it is by default installed at **Documents\\ComponentOne Samples\\ASP.NET MVC\\MVC\\HowTo\\FlexViewer**).<br /><br />If the report is using any local database (such as an MDB or an MDF file), then add the database to the **App\_Data** folder of your application. However, make sure that the connection string of the reports are pointing to the **App\_Data** folder accordingly.<br /><br />![](https://cdn.mescius.io/document-site-files/images/2b3ac322-100e-4637-958d-fb40dcda3f44/images/flexreportdatasource.png)<br />
	> type=note
	> **Note**: Make sure you add **Microsoft.Owin.Cors** Nuget package in your application, for app.UseCors();

### Set Report's Root Location

1.  In the **Startup.cs** file, add the following code inside **Configuration** method of the **Startup class**.
    
    ```csharp
    app.UseCors(CorsOptions.AllowAll);
    var folder = GetFullRoot("Files");
    app.AddDiskStorage("root", folder);
    ```
    
    This code registers the folder/location where the Report files will be stored, in this case it is the "Files" folder.
    
2.  Add the **GetFullRoot** function inside **Startup** class.
    
    ```csharp
    private static string GetFullRoot(string root)
    {
            var applicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            var fullRoot = Path.GetFullPath(Path.Combine(applicationBase, root));
            if (!fullRoot.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
            {
                    fullRoot += Path.DirectorySeparatorChar;
            }
            return fullRoot;
    }
    ```

### Deploy FlexReport Web API Service

1.  Compile the project.
2.  Deploy the project to IIS.

The Web API URL, for service hosted on local IIS, will be created.


> type=note
> **Note**: Once you have successfully created **Web API URL** for Report Services, you can access and view reports stored in the service using FlexViewer for MVC and Wijmo Viewer. For more information on how to view reports, see [Viewing Reports in FlexViewer](/componentone/docs/mvc/online-mvc/workwithcontrols/FlexReportViewer/FlexViewer/ViewingReportsinFlexViewer).