<commit_before>---
title: 'The Next AGRC WebAPI'
author:
  display_name: <NAME>
  email: <EMAIL>
date: 2018-09-12 00:12:00
categories:
  - Featured
  - Developer
tags:
  - webapi
  - cloud
---

The current [WebAPI](https://api.mapserv.utah.gov) has been in production serving the public for multiple years. It handles millions of requests for spatial information every month and is free to use with a simple to create [API key](https://developer.mapserv.utah.gov/StartupGuide). While it receives constant [enhancements](https://github.com/agrc/api.mapserv.utah.gov/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed+label%3Aenhancement) and [bug fixes](https://github.com/agrc/api.mapserv.utah.gov/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed+label%3Abug), there have been no breaking changes to the API, nor have there been any major architectural updates. That is about to change with a major update currently in the works.

The interesting and often wild office discussions about how to improve the WebAPI have not been backed by concrete efforts until now. Implementing these ideas is now possible since key technologies have made amazing advancements while others have matured. AGRC is ready to combine our ideas with new technologies to make the WebAPI even better. Work has already started on what will most likely be [version 2](https://github.com/agrc/api.mapserv.utah.gov/tree/development) of the WebAPI. And we hope to bring the same improvements to version 1 without interruption.

## <i class="fas fa-history"></i> The History <i class="fas fa-history fa-flip-horizontal"></i>

The WebAPI proof of concept was built using [ASP.NET WCF](https://docs.microsoft.com/en-us/dotnet/framework/wcf/whats-wcf). After getting positive internal feedback (_and usage in production, of course_), we wrote version 1 of the WebAPI using ASP.NET WebAPI 3. The ASP.NET WebAPI then merged with ASP.NET MVC, and we are currently running on ASP.NET MVC 5.

[RavenDB](https://ravendb.net/) is the user and key store and [Redis](https://redis.io) is being used for analytics and reporting. Redis and RavenDB are both running as Windows services and the WebAPI and developer website are hosted as separate sites in IIS. Supplementary data is cached from Google Sheets to allow for easy modifications.

Reading that last paragraph may have made you think that it would be hard to replicate or upgrade the entire WebAPI system. If that's the case--you are  [correct](https://github.com/agrc/api.mapserv.utah.gov/wiki). The list of installation instructions and documentation for the version 1 WebAPI system are as frustrating as they are long. A design goal of version 2 is to eliminate that friction as much as possible.

## <i class="fas fa-rocket"></i> The Future <i class="fas fa-rocket fa-flip-horizontal"></i>

The new framework we plan to use, [ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-2.1), is a ground-up redesign of ASP.NET 4 with the important design goals of being cross platform, lean, and modular. From our experience, this framework is [fast](https://www.techempower.com/benchmarks/#section=data-r16&hw=ph&test=plaintext)! The WebAPI in development is running on ASP.NET Core 2.2 preview 2. From our testing, it can handle much more throughput than the current system. A huge benefit of this framework is that developers at the AGRC can run or develop this code using [Visual Studio Code](https://code.visualstudio.com/) and [Visual Studio IDE](https://visualstudio.microsoft.com/) on Windows, Mac, and Linux. This creates a great developer experience by allowing any and all development environments. The cross platform abilities enables this project to enter the world of [Docker](https://www.docker.com/) and [Kubernetes](https://kubernetes.io/).

## <i class="fab fa-docker"></i> Containers <i class="fab fa-docker fa-flip-horizontal"></i>

Version 2 of the WebAPI is being built for containers. It will run without them, but building the correct runtime environment is much simpler using them. The system is currently comprises  four containers that will likely expand to six or more.

1. The ASP.NET Core WebAPI service
2. The ASP.NET Core developer website
3. The PostgreSQL database<commit_msg>update date<commit_after>---
title: 'The Next AGRC WebAPI'
author:
  display_name: <NAME>
  email: <EMAIL>
date: 2018-09-13 00:12:00
categories:
  - Featured
  - Developer
tags:
  - webapi
  - cloud
---

The current [WebAPI](https://api.mapserv.utah.gov) has been in production serving the public for multiple years. It handles millions of requests for spatial information every month and is free to use with a simple to create [API key](https://developer.mapserv.utah.gov/StartupGuide). While it receives constant [enhancements](https://github.com/agrc/api.mapserv.utah.gov/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed+label%3Aenhancement) and [bug fixes](https://github.com/agrc/api.mapserv.utah.gov/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed+label%3Abug), there have been no breaking changes to the API, nor have there been any major architectural updates. That is about to change with a major update currently in the works.

The interesting and often wild office discussions about how to improve the WebAPI have not been backed by concrete efforts until now. Implementing these ideas is now possible since key technologies have made amazing advancements while others have matured. AGRC is ready to combine our ideas with new technologies to make the WebAPI even better. Work has already started on what will most likely be [version 2](https://github.com/agrc/api.mapserv.utah.gov/tree/development) of the WebAPI. And we hope to bring the same improvements to version 1 without interruption.

## <i class="fas fa-history"></i> The History <i class="fas fa-history fa-flip-horizontal"></i>

The WebAPI proof of concept was built using [ASP.NET WCF](https://docs.microsoft.com/en-us/dotnet/framework/wcf/whats-wcf). After getting positive internal feedback (_and usage in production, of course_), we wrote version 1 of the WebAPI using ASP.NET WebAPI 3. The ASP.NET WebAPI then merged with ASP.NET MVC, and we are currently running on ASP.NET MVC 5.

[RavenDB](https://ravendb.net/) is the user and key store and [Redis](https://redis.io) is being used for analytics and reporting. Redis and RavenDB are both running as Windows services and the WebAPI and developer website are hosted as separate sites in IIS. Supplementary data is cached from Google Sheets to allow for easy modifications.

Reading that last paragraph may have made you think that it would be hard to replicate or upgrade the entire WebAPI system. If that's the case--you are  [correct](https://github.com/agrc/api.mapserv.utah.gov/wiki). The list of installation instructions and documentation for the version 1 WebAPI system are as frustrating as they are long. A design goal of version 2 is to eliminate that friction as much as possible.

## <i class="fas fa-rocket"></i> The Future <i class="fas fa-rocket fa-flip-horizontal"></i>

The new framework we plan to use, [ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-2.1), is a ground-up redesign of ASP.NET 4 with the important design goals of being cross platform, lean, and modular. From our experience, this framework is [fast](https://www.techempower.com/benchmarks/#section=data-r16&hw=ph&test=plaintext)! The WebAPI in development is running on ASP.NET Core 2.2 preview 2. From our testing, it can handle much more throughput than the current system. A huge benefit of this framework is that developers at the AGRC can run or develop this code using [Visual Studio Code](https://code.visualstudio.com/) and [Visual Studio IDE](https://visualstudio.microsoft.com/) on Windows, Mac, and Linux. This creates a great developer experience by allowing any and all development environments. The cross platform abilities enables this project to enter the world of [Docker](https://www.docker.com/) and [Kubernetes](https://kubernetes.io/).

## <i class="fab fa-docker"></i> Containers <i class="fab fa-docker fa-flip-horizontal"></i>

Version 2 of the WebAPI is being built for containers. It will run without them, but building the correct runtime environment is much simpler using them. The system is currently comprises  four containers that will likely expand to six or more.

1. The ASP.NET Core WebAPI service
2. The ASP.NET Core developer website
3. The PostgreSQL database
{'fraction_non_alphanumeric': 0.08594301860136568, 'fraction_numerical': 0.009653873322345186, 'mean_word_length': 4.640770252324037, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 30, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6427494', 'n_tokens_mistral': 2392, 'n_tokens_neox': 2265, 'n_words': 1080}