HTTP

Call your Azure AD B2C protected API with authenticated HTTP requests from your JetBrains IDE

Automatically acquire OAuth 2.0 tokens

I have written several blog posts about HTTP clients in the past. I am a big fan of using HTTP text files versioned in a git repository alongside API code and executed by an IDE tooling. However, there was one use case where a GUI tool like Postman or a swagger page was more convenient: retrieving OAuth 2.0 users' tokens. Thanks to the latest OAuth 2.0 feature in JetBrains' IDE built-in HTTP client, this is no longer an issue.

Read more...

Playing with the .NET 8 Web API template

Enhanced weather forecast API

In this article, we will explore the latest C# 12 and .NET 8 features by applying them to the basic dotnet Web API template.

Read more...

Discussion about API clients

What should you consider when choosing an API client?

This article is a discussion about API clients. Without being a comparison between the best API clients, this article talks about the pros and cons of some popular tools to send HTTP requests to an API. The goal is not to elect the best one, but rather to try to answer the following question: what we should consider when choosing an API client, and what are the challenges when using one?

Read more...

Keeping secrets secure when using API Clients

Playing with Azure CLI and Nushell to generate a secret environment file to send HTTP requests

When using some API Clients (like REST Client or the HTTP Client of JetBrains' IDEs), environment variables are stored in JSON files that can contain secrets. To share these files within a team, developers tend to send them by email or by messaging applications, which is not very convenient nor secure 🔐. I thought it would be a good idea to store these secrets directly in an Azure Key Vault and automate the generation of a JSON file containing the secrets using Azure CLI and Nushell.

Read more...

Once upon a time in .NET

A story about records, HTTP message handlers, HTTP client extensions...

In this article, I want to talk about a few things in .NET such as HTTP requests with an Http Client, HTTP message handlers, records... For the theoretical aspect of these topics, I think the official documentation on docs.microsoft.com and many blog articles already explain them very well, better than I could ever do. But what I am interested in here is to talk about these topics through a case study.

Read more...

Handle token retrieval while querying an API

Using a DelegatingHandler

In our daily job, we often have to query secure REST APIs that require our HTTP requests to have a valid access token in their Authorization header. Of course, many APIs come with an SDK that makes the job easier for us as it directly takes care of retrieving a token and sending the authenticated HTTP requests. However, it is not always the case and knowing how to implement that using HttpClient, IMemoryCache, and DelegatingHandler can become pretty useful.

Read more...

Testing your API with REST Client

Why using the vscode extension "REST Client" instead of Postman?

Let's talk about tooling and testing an API!

Read more...