A deep dive into the latest OpenAPI and Swagger improvements in ASP.NET Core 10, including Minimal APIs, versioning, Native AOT support, and UI customization.
Search Results for: api
WebApiDocumentator: an alternative to Swagger
The NuGet package WebApiDocumentator is an alternative to Swagger and the design is simple and more useful for developers and end users
APIs with Entity Framework Core: PUT
Continue the tutorial about APIs with Entity Framework Core and in particular how to implemente the PUT to update a record with dependencies.
APIs with Entity Framework Core: POST
Here how to change the minimal APIs with Entity Framework Core for POST and GET in order to save and retrieve an object with dependencies.
APIs with Entity Framework Core
I want to give a complete example of minimal APIs in Blazor with Entity Framework Core with complex objects.
Using ChatGPT library for grammar checker API
In this article, we’ll show you a way for using my new ChatGPT library for a grammar checker API with ASP.NET Core step-by-step
Call API Management from Blazor
The title ”Call API Management from Blazor” is not explain fully what I’m going to explain in this post but it is only a title. So, consider the following scenario. Scenario On Azure API Management Service you have your APIs. For more protection, you want to add another level of security asking to the API Management to validate the user token for each request. The token is validated again your own Identity Server. Once the API Management is configured to use Identity Server for the validation, you want to call…
Handling file uploads in OpenAPI
This post is about implementing handling file uploads in OpenAPI with ASP.NET Core. Open API is one way to document REST API endpoints.
Testing APIs with RestClient in Visual Studio Code
I show a simple way for Testing APIs with RestClient in Visual Studio Code. RestClient is a simple extension for Visual Studio Code.
Minimal APIs in NET6
From now on, we can create minimal APIs in NET6 that allows us to write in few lines of code powerful APIs. I collect all my understanding
Configure CORS in API Management
I will show you how to configure CORS in the API Management Service in Azure and avoid the mistake I did when I configure this service
How to use an Azure API Management Service
API Management creates consistent and modern API gateways for existing back-end. How to use an Azure API Management Service in a real world?
Adding an API using ASP.NET Core
Adding an API using ASP.NET Core is the subject of this new post related to explain how to implement a project in a clean architecture
Creating .NET Core API with versioning
A versioning allows clients to continue using the existing REST API and migrate their applications to the newer API when they are ready.
Adding Swagger UI to Azure Function APIs
You can set up Swagger UI in your Azure Function API to allow for providing documentation for your serverless API pretty easily
Azure WebJobs API
This API is accessed the same way as the git endpoint. e.g. if your git URL is https://yoursite.scm.azurewebsites.net/yoursite.git, then the API to get the list of deployments will be https://yoursite.scm.azurewebsites.net/deployments. The credentials you use are the same as when you git push. See Deployment-credentials for more details. List all web jobs GET /api/webjobs Triggered Jobs List all triggered jobs GET /api/triggeredwebjobs Response [ { name: “jobName”, runCommand: “…\run.cmd”, type: “triggered”, url: “https://…/triggeredwebjobs/jobName”, history_url: “https://…/triggeredwebjobs/jobName/history”, extra_info_url: “https://…/”, scheduler_logs_url: “https://…/vfs/data/jobs/triggered/jobName/job_scheduler.log”, settings: { }, using_sdk: false, latest_run: { id: “20131103120400”, status: “Success”, start_time:…
Adding Swagger to Web API project
Adding Swagger to your Web API project does not replace ASP.NET Web API help pages. Or maybe yes? Here how to implement Swagger in your apps
$.ajax No ‘Access-Control-Allow-Origin’ header is present on the requested resource with WebAPI
I want to get data from a WebAPI with jquery $("#btnSend").click(function () { $("#sending").show(); $.ajax({ type: ‘GET’, url: ‘/Report/SendEmail?quote=18’, crossDomain: true, success: function (msg) { if (msg == ‘True’) { alert(‘Email sent to the client’); } $("#sending").hide(); }, error: function (request, status, error) { $("#sending").hide(); } }); }); and it produce ‘No Access-Control-Allow-Origin’ header is present on the requested resource error. The solution is to add in the result of the WebAPI the following code: Response.Headers.Add(“Access-Control-Allow-Methods”, “GET, POST”); Response.Headers.Add(“Access-Control-Allow-Headers”, “accept, authority”); Response.Headers.Add(“Access-Control-Allow-Credentials”, “true”); Happy coding!
Microsoft REST API Design Guidelines
Microsoft is publishing its “REST API Design Guidelines” to the API community: https://www.GitHub.com/microsoft/api-guidelines/. These guidelines represent a multi-year, cross-company, collaborative process aggregating the collective experience of hundreds of engineers designing, operating, and running global scale cloud services from across Microsoft; and listening to feedback on our APIs from customers and partners. We have attempted to incorporate those learnings along with industry best practices in the API space to create guidelines that API teams across Microsoft use on a daily basis. Our hope in publishing these guidelines to the greater API…
Introducing the IIS Administration API
The IIS team has been working on a new RESTful API to manage your IIS configuration. While still under development, the team was eager to share a preview of the new API. The API allows configuration of IIS resources such as authorization rules, modules, and applications. The API has been built with Hypertext Application Language (HAL) to allows APIs to have built-in discoverability. Starting at the root of the API, you can browse the entire API surface. In addition to the API, the IIS team has also built an API…
Customize Json result in Web API
If you work with Visual Studio 2015 and WebAPI, this short post is for you! We have to make our Web API project easy to debug so, I’m going to remove the XML formatter. I’m doing that because I’m in a test project and I’d like to see the response in the browser. The easily way to force the response to Json for all Web API requests is to remove the XML. Obviously you shouldn’t do it in production. Global.asax var formatters = GlobalConfiguration.Configuration.Formatters; formatters.Remove(formatters.XmlFormatter); Now we can start change…
Creating a URL shortener using ASP.NET WepAPI and MVC: error handling
In the two previous post I discussed about the first step to creare this application and the implementation of the business logic. Now we can implement the error handling. We have two custom exception classes: ShorturlConflictException (when a segment already exists) and ShorturlNotFoundException (when a segment isn’t found in the database). There is also a third type: an unexpected exception, for example when there is no database connection. Normally, the user will see these errors. We have to build a mechanism where these exceptions are caught and a nice error…
Creating a URL shortener using ASP.NET WepAPI and MVC: implementing the business layer
In my previsious post I discussed the first implementation of this application. In this post I’m explained how to implement the business layer. First of all you make sure the Business project references the Data, Entities and Exceptions projects. In the Exceptions project you add two new classes: ShorturlConflictException using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PSC.Shorturl.Web.Exceptions { public class ShorturlConflictException : Exception { } } ShorturlNotFoundException using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PSC.Shorturl.Web.Exceptions { public class ShorturlNotFoundException : Exception {…
Creating a URL shortener using ASP.NET WepAPI and MVC
In this tutorial, I use several techniques and tools. I use Microsoft Visual Studio 2015 and the latest version of all components. ASP.NET MVC: Microsoft’s modern web application framework. As the name says, it pushes you to use the MVC (model view controller) software design principle. ASP.NET Web API: Web API and MVC are used together in many applications. With MVC, the HTML of the web pages are rendered on the server, and with Web API you can, like the name says, create an API. Web API also uses the…
Blogger C# API
using System;using System.Text;using Google.GData.Client;using System.Net;using System.Xml;using System.Text.RegularExpressions;namespace BloggerDevSample{ class ConsoleSample { /** Lists the user’s blogs. */ static void ListUserBlogs(Service service) { Console.WriteLine(“\nRetrieving a list of blogs”); FeedQuery query = new FeedQuery(); // Retrieving a list of blogs query.Uri = new Uri(“https://www.blogger.com/feeds/default/blogs”); AtomFeed feed = null; feed = service.Query(query); foreach (AtomEntry entry in feed.Entries) { Console.WriteLine(” Blog title: ” + entry.Title.Text); } } /** Lists the user’s blogs and returns the URI for posting new entries * to the blog which the user selected. */ static Uri SelectUserBlog(Service service) {…