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?

Developer technologies | .NET | Blazor
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,176 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,851 Reputation points Volunteer Moderator
    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.