"Query string for this HTTP request type is an invalid URL." when executing a stored procedure using POST
See original GitHub issueWhen calling a stored procedure, also passing parameters, using the POST method, I get the following error:
{
"error": {
"code": "BadRequest",
"message": "Query string for this HTTP request type is an invalid URL.",
"status": 400
}
}
everything works fine if I use the GET method. I haven’t tested with other HTTP methods, but I suspect I’ll get the same error.
This is the error message I can see in the log:
Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'Azure.DataApiBuilder.Service.Controllers.RestController.Insert (Azure.DataApiBuilder.Service)'
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]
Route matched with {action = "Insert", controller = "Rest"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Insert(System.String) on controller Azure.DataApiBuilder.Service.Controllers.RestController (Azure.DataApiBuilder.Service).
fail: Azure.DataApiBuilder.Service.Controllers.RestController[0]
Query string for this HTTP request type is an invalid URL.
fail: Azure.DataApiBuilder.Service.Controllers.RestController[0]
at Azure.DataApiBuilder.Service.Services.RequestValidator.ValidateInsertRequest(String queryString, String requestBody)
at Azure.DataApiBuilder.Service.Services.RestService.PopulateStoredProcedureContext(Operation operationType, DatabaseObject dbObject, String entityName, String queryString, String primaryKeyRoute, String requestBody, RestRequestContext& context)
at Azure.DataApiBuilder.Service.Services.RestService.ExecuteAsync(String entityName, Operation operationType, String primaryKeyRoute)
at Azure.DataApiBuilder.Service.Controllers.RestController.HandleOperation(String route, Operation operationType)
Issue Analytics
- State:
- Created 7 months ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Calling a stored procedure with Entity Framework Core ...
When I debug, I get the following error: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has ...
Read more >Maintenance Plan Wizard generates invalid script?
In this case, the "Maintenance Cleanup Task" was missing the path (the wizard does not seem to validate whether you enter one).
Read more >Invalid URL Path Error - OutSystems 11 Documentation
The Invalid URL Path error is issued in the following situations: Message: 'URL Path' property must start with '/'. Cause: The specified URL...
Read more >SQL Queries - EF Core
Using SQL queries in Entity Framework Core. ... SQL queries can be used to execute a stored procedure which returns entity data:.
Read more >How to implement error handling in SQL Server
This article explains how to implement SQL error handling using the SQL server try-catch statement and what can be done in general when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
May bad, I didn’t remember that. Documentation doesn’t mention it (https://github.com/Azure/data-api-builder/blob/main/docs/views-and-stored-procedures.md#rest-support-for-stored-procedures) so it needs to be added as now only mention the following:
which is incomplete
@yorek, this is by design from the stored procedure specification
For POST-ing to GetCowrittenBooksByAuthor you’d have to add a JSON request body with your desired parameters/values: URL:
[POST] /api/cowrittenBooksByAuthor
Body:https://github.com/Azure/data-api-builder/blob/daf7dd8bf6737266b32b3eb86fb926dacd92f8a8/docs/internals/StoredProcedureDesignDoc.md?plain=1#L35-L38