{"id":6302,"date":"2025-12-01T14:16:41","date_gmt":"2025-12-01T22:16:41","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/azure-sql\/?p=6302"},"modified":"2026-02-23T11:23:18","modified_gmt":"2026-02-23T19:23:18","slug":"data-api-builder-request-body-strict","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/azure-sql\/data-api-builder-request-body-strict\/","title":{"rendered":"Data API builder\u2019s &#8220;request-body-strict&#8221; Simplifies Client Code"},"content":{"rendered":"<p>Data API builder (DAB) provides REST and GraphQL endpoints over SQL Server, Azure Cosmos DB, PostgreSQL, MySQL, and SQL Data Warehouse. <a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2023\/10\/dab-logo.png\"><img decoding=\"async\" class=\"size-medium wp-image-2563 alignright\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2023\/10\/dab-logo-300x300.png\" alt=\"Data API builder (DAB) Logo\" width=\"300\" height=\"300\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2023\/10\/dab-logo-300x300.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2023\/10\/dab-logo-150x150.png 150w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2023\/10\/dab-logo-24x24.png 24w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2023\/10\/dab-logo-48x48.png 48w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2023\/10\/dab-logo-96x96.png 96w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2023\/10\/dab-logo.png 336w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a> The <code>request-body-strict<\/code> configuration value controls how REST endpoints treat unknown JSON properties in the payload: \n*   When set to <code>true<\/code> (default), unknown properties are rejected and an exception is thrown.\n*   When set to <code>false<\/code>, unknown properties are allowed and ignored. This is especially useful for .NET developers. Read<\/p>\n<p><a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/data-api-builder\/configuration\/runtime#rest-runtime\">the documentation<\/a>.<\/p>\n<h2 class=\"heading-element\" tabindex=\"-1\">\n  Let&#8217;s try it out\n<\/h2>\n<h3>The database table Imagine a simple table called Category with only two columns:<\/h3>\n<pre class=\"prettyprint language-sql\"><code class=\"language-sql\">CREATE TABLE Category (\n    Id INT PRIMARY KEY,\n    Name VARCHAR(100)\n)<\/code><\/pre>\n<h3>The configuration file Create your Data API builder configuration file with the following command line commands:<\/h3>\n<div>\n<div>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">dab init --database-type mssql --connection-string \"&lt;your-connection-string&gt;\" --host-mode development\ndab add Category --source dbo.Category --permissions anonymous:*\ndab start<\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<h3>The JSON payload When you call the REST endpoint for Category at<\/h3>\n<p><code>https:\/\/localhost:5001\/api\/Category<\/code>, the resulting JSON looks like this:<\/p>\n<pre class=\"prettyprint language-json\"><code class=\"language-json\">{\n  \"value\": [\n    {\n      \"Id\": 1,\n      \"Name\": \"Category 1\"\n    },\n    {\n      \"Id\": 2,\n      \"Name\": \"Category 2\"\n    },\n    {\n      \"Id\": 3,\n      \"Name\": \"Category 3\"\n    }\n  ]\n}<\/code><\/pre>\n<h3>The C# class To deserialize this JSON in .NET, you would use C# classes similar to these:<\/h3>\n<pre class=\"prettyprint language-cs language-csharp\"><code class=\"language-cs language-csharp\">public class Root\n{\n    [JsonPropertyName(\"value\")]\n    public List&lt;Category&gt; Categories { get; set; }\n}\n\npublic class Category\n{\n    [JsonPropertyName(\"Id\")]\n    public int Id { get; set; }\n    \n    [JsonPropertyName(\"Name\")]\n    public string Name { get; set; }\n}<\/code><\/pre>\n<h3>Updating data when request-body-strict is true When<\/h3>\n<p><code>request-body-strict<\/code> is <code>true<\/code>, you update a record by sending a PATCH request to <code>https:\/\/localhost:5001\/api\/Category\/Id\/1<\/code>. The request body cannot include the <code>Id<\/code> property since it&#8217;s already in the URL. This requires creating a separate C# class for updates:<\/p>\n<pre class=\"prettyprint language-cs language-csharp\"><code class=\"language-cs language-csharp\">public class Category_NoPK\n{\n    [JsonPropertyName(\"Name\")] \n    public string Name { get; set; }\n}<\/code><\/pre>\n<p>This allows you to pass the payload to the REST endpoint without errors and successfully update the database record.<\/p>\n<h3>Updating data when request-body-strict is false \u2b50 When<\/h3>\n<p><code>request-body-strict<\/code> is <code>false<\/code>, you can send the same PATCH request but include the full <code>Category<\/code> class in the body. The <code>Id<\/code> property will simply be ignored. This provides a much better experience for .NET developers, allowing you to reuse the same <code>Category<\/code> class for both reading and updating. Yes, it&#8217;s that easy.<\/p>\n<h2>Conclusion Using REST to Create, Read, Update, or Delete database records with Data API builder is straightforward. By setting<\/h2>\n<p><code>request-body-strict<\/code> to <code>false<\/code>, you can write less code with fewer types and simpler payloads when working with your API. <div  class=\"d-flex justify-content-left\"><a class=\"cta_button_link btn-primary mb-24\" href=\"https:\/\/aka.ms\/dab\/docs\" target=\"_blank\">Data API builder<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Data API builder (DAB) provides REST and GraphQL endpoints over SQL Server, Azure Cosmos DB, PostgreSQL, MySQL, and SQL Data Warehouse. The request-body-strict configuration value controls how REST endpoints treat unknown JSON properties in the payload: * When set to true (default), unknown properties are rejected and an exception is thrown. * When set to [&hellip;]<\/p>\n","protected":false},"author":96788,"featured_media":6608,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[444,597],"tags":[409,560],"class_list":["post-6302","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net","category-data-api-builder-2","tag-api","tag-data-api-builder"],"acf":[],"blog_post_summary":"<p>Data API builder (DAB) provides REST and GraphQL endpoints over SQL Server, Azure Cosmos DB, PostgreSQL, MySQL, and SQL Data Warehouse. The request-body-strict configuration value controls how REST endpoints treat unknown JSON properties in the payload: * When set to true (default), unknown properties are rejected and an exception is thrown. * When set to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/posts\/6302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/users\/96788"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/comments?post=6302"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/posts\/6302\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/media\/6608"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/media?parent=6302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/categories?post=6302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/tags?post=6302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}