Round #739
10 May 2026, 15:18· csharp· Meta-Llama-3.3-70B-Instruct· r13-clean-hints
- Complexity
- band 0
- ZP / UO / OBS
- 2 / 4 / 0
- Journey weight
- 324
- Lightshift ΔL
- —
Prompt
Write a Web API POST endpoint that accepts a JSON body and returns Created.
Zero-point index (what the engine surfaced)
ZPI-ZPI-0013 | 2026-05-10T15:18:52Z
Write a Web API POST endpoint that accepts a JSON body and returns Created.
ZERO POINT — 2 entries (structural invariants)
● hsl(27.69, 100%, 50%) async [feature]
● hsl(145.64, 100%, 50%) Task of T [feature]
UNOBSERVED — 4 entries (implied truths)
○ hsl(9.23, 100%, 50%) interface [feature]
○ hsl(77.54, 100%, 42%) Routing middleware [function]
○ hsl(83.08, 100%, 42%) ILogger of T injection [function]
○ hsl(31.38, 100%, 42%) Scoped registration [function]
OBSERVED — 0 entries (explicit in request)
COMPLEXITY │ 6 entries │ spread: 74° │ band: LOW
Baseline response (no ZPI)
### Creating a Web API POST Endpoint in C#
Below is an example of how to create a Web API POST endpoint in C# that accepts a JSON body and returns a 201 Created status code.
#### Model
```csharp
public class MyModel
{
public int Id { get; set; }
public string Name { get; set; }
}
```
#### Controller
```csharp
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
[ApiController]
[Route("api/[controller]")]
public class MyController : ControllerBase
{
[HttpPost]
public async Task<IActionResult> Create([FromBody] MyModel model)
{
// Process the model here
// For example, save it to a database
// Return a 201 Created status code
return CreatedAtAction(nameof(Create), new { id = model.Id }, model);
}
}
```
#### Explanation
* We define a `MyModel` class to represent the JSON body.
* We create a `MyController` class with a `Create` method that handles HTTP POST requests.
* The `[FromBody]` attribute specifies that the `model` parameter should be deserialized from the request body.
* We process the `model` as needed (e.g., save it to a database).
* Finally, we return a 201 Created status code using the `CreatedAtAction` method, which also returns the created resource in the response body.
#### Example Use Case
To test this endpoint, you can use a tool like Postman or curl to send a POST request with a JSON body:
```json
{
"id": 1,
"name": "John Doe"
}
```
The response should be a 201 Created status code with the created resource in the response body:
```json
{
"id": 1,
"name": "John Doe"
}
```
#### Full Example with Startup Configuration
Here's a full example with startup configuration:
```csharp
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
```
This example sets up a basic ASP.NET Core Web API project with a single controller and endpoint. You can run the project and test the endpoint using a tool like Postman or curl.
Enhanced response (with ZPI)
```csharp
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace MyApi.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class MyController : ControllerBase
{
private readonly ILogger<MyController> _logger;
public MyController(ILogger<MyController> logger)
{
_logger = logger;
}
[HttpPost]
public IActionResult Create([FromBody] MyModel model)
{
try
{
// Process the model
_logger.LogInformation($"Created new resource: {model}");
return CreatedAtAction(nameof(Create), model);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error creating new resource");
return StatusCode(500, "Internal Server Error");
}
}
}
public class MyModel
{
public string Name { get; set; }
public string Description { get; set; }
}
}
```
In this implementation, we define a `MyController` class that handles HTTP requests. The `Create` method is decorated with the `[HttpPost]` attribute, indicating that it handles HTTP POST requests. The method takes a `MyModel` object as a parameter, which is deserialized from the JSON body of the request.
We use the `ILogger<T>` interface to log information and errors. The logger is injected into the controller through the constructor.
If the model is processed successfully, we return a `201 Created` response with the created resource. If an error occurs, we log the error and return a `500 Internal Server Error` response.
Note that you will need to register the `MyController` class in the Startup.cs file, and also configure the routing and logging middleware.
For example, in the `Startup.cs` file:
```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddLogging(loggingBuilder => loggingBuilder.AddConsole());
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
```
This will enable the Web API to handle requests and log information to the console.
Grader chain
Each grader reads the same baseline + enhanced pair and casts an independent verdict. Disagreement is the framework's own signal — not noise to be averaged away.
V1samba/Meta-Llama-3.3-70B-Instruct
BetterV4qwen2.5-coder-3b-instruct
BetterV5openrouter/qwen/qwen3-235b-a22b-2507
BetterV7qwen2.5-coder-7b-instruct
BetterV8openai/gpt-4.1
BetterV9anthropic/claude-opus-4-7
WorseV12openai/gpt-4o
BetterComments
Our grader said what it said. What do you say? Comment as a guest below.
No comments yet. Be the first to say what you make of this round.