POST API Call Failing with 405 Error in Azure Static Web Apps

Shreyas Rastogi 225 Reputation points
2024-12-02T16:13:21.29+00:00

A Blazor WebAssembly app is configured to connect to a SQL database following the guidance in this article: How to host static web apps.

The API status is healthy, and GET calls work as expected. However, POST calls to add records to the database return a 405 error, indicating that only GET, HEAD, and OPTIONS methods are allowed.

Is there a configuration or change required to enable the POST API call to work?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,645 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,036 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 69,121 Reputation points
    2024-12-02T17:07:30.19+00:00

    this is really a question about the Data API Builder application. You appear to be using the REST API. did you enable posts? we would need to see the "rest" section of the entity definition from the config file to help.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.