Use Service Reference in Visual Studio 2019 to consume a REST API with OpenAPI description from a C# console app
In this tutorial I will show you how easy it is to consume a REST API Service using the ‘Service Reference …’ feature in Visual Studio 2019. I will consume a simple service located at https://api4all.azurewebsites.net/ . Prerequisites: You need to have Visual Studio 2019 installed on your Windows computer. In my case, I am using: Microsoft Visual Studio Community 2019 Version 16.8.2 The REST API you are consuming needs to have an OpenAPI programming language-agnostic interface description for REST APIs. Point your browser to https://api4all.azurewebsites.net/ . The landing page is an OpenAPI page that has the following heading: Copy the link to the s wagger.json file in the top-left corner and park it in Notepad.exe for later use. Let us create a simple “Console App (.NET Core)” application in Visual Studio 2019 to consume the REST API service. Once your console app is created, Add >> Service...