Skip to main content

66 posts tagged with "Web API"

Building HTTP Web APIs That Other Apps Call

View All Tags

How to Use a Concurrency Token in EF Core with MySQL

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

When two people edit the same row, the second save overwrites the first, and nobody finds out. A concurrency token fixes this: a column that changes with every update, and that EF Core adds to the WHERE of each UPDATE. If it changed since you read the row, the update finds nothing, and you can tell the client. This guide adds one on MySQL.

How to Send API Requests from a .http File in VS Code and Visual Studio

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

A .http file is a plain text file that holds API requests. It lives next to your code and goes into Git with it, so everyone on the team has the same requests. VS Code with the free REST Client extension and Visual Studio both add a link above each request that sends it. This guide covers the format and how to send requests in each editor.

Fixed: "Body was inferred but the method does not allow inferred body parameters" in a Minimal API

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

After I added one small GET endpoint, every request to my minimal API answered 500, health checks included. The log said Body was inferred but the method does not allow inferred body parameters. The endpoint took a record as a parameter, and ASP.NET Core assumes that comes from the JSON body, which GET doesn't get. [AsParameters] tells it to read the query string instead.

Fixed: "415 Unsupported Media Type" from a POST to an ASP.NET Core Minimal API

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

A POST with perfectly good JSON came back as 415 Unsupported Media Type, and the API's log had nothing to say about it. The JSON wasn't the problem: the request never said it was JSON. curl labels a -d body as a web form unless you tell it otherwise, and a minimal API endpoint that expects JSON won't touch that.