

This tutorial focuses on creating a web API. Swagger is used to generate useful documentation and help pages for web APIs. If the Swagger page doesn't appear, see this GitHub issue. A drop down list box with media types and the example value and schema.The URL to test the WeatherForecast API.The Curl command to test the WeatherForecast API.The Swagger page /swagger/index.html is displayed. In a browser, navigate to where is the randomly chosen port number displayed in the output.įor Visual Studio for Mac, see the. Select Create tasks.json file from template.In the Could not find the task 'build' dialog, select Configure Task.At the Select environment prompt, choose.See Trust the ASP.NET Core HTTPS development certificate for more information. The preceding command displays the following dialog, provided the certificate was not previously trusted: See your Linux distribution's documentation for trusting a certificate. The preceding command doesn't work on Linux. Trust the HTTPS development certificate by running the following command: dotnet dev-certs https -trust Visual Studio launches the default browser and navigates to where is a randomly chosen port number.

Select Yes if you agree to trust the development certificate.įor information on trusting the Firefox browser, see Firefox SEC_ERROR_INADEQUATE_KEY_USAGE certificate error. Select Yes if you trust the IIS Express SSL certificate. Visual Studio displays the following dialog when a project is not yet configured to use SSL: Press Ctrl+F5 to run without the debugger. Open a command terminal in the project folder and run the following command: dotnet add package At the bottom of the list, select New Terminal at Folder.To access a command terminal from Finder: To access a command terminal from Visual Studio for Mac: The preceding instructions enable accessing a command terminal two ways: from inside Visual Studio or from Finder. Under Files and Folders, verify New Terminal at Folder is selected.Navigate to System Preferences > Keyboard > Shortcuts > Services.Select Next.Įnter TodoApi for the Project Name and then select Create.Īccessing a command terminal on Mac for the first time requires the following setting configurations: In the Configure the new ASP.NET Core Web API dialog, select the latest. In version 8.6 or later, select Web and Console > App > API > Next. In Visual Studio for Mac earlier than version 8.6, select. When a dialog box asks if you want to add required assets to the project, select Yes. Add a NuGet package that is needed for the next section.Create a new web API project and open it in Visual Studio Code.Run the following commands: dotnet new webapi -o TodoApiĭotnet add package Confirm the checkbox for Use controllers(uncheck to use minimal APIs) is checked.Ĭhange directories ( cd) to the folder that will contain the project folder.In the Configure your new project dialog, name the project TodoApi and select Next.Select the ASP.NET Core Web API template and select Next.From the File menu, select New > Project.
