Unexpected POST request payload when batch updating a recurring event
Hi,
Whenever I update a recurring item on the Blazor scheduler component, which appears to send a POST batch request, the request's body does not contain the JSON corresponding to the CRUDModel object that your docs say to expect on the server endpoint. Instead it contains the raw data below. Is this expected? If so, how are we supposed to consume this on the server?
Thank you
--batch_0b7f39b4-756e-4f70-9b8e-3ba32e68c273
Content-Type: multipart/mixed; boundary="changeset_e9b3b1c1-dd4a-4bca-baa4-f805824b9305"
--changeset_e9b3b1c1-dd4a-4bca-baa4-f805824b9305
Content-Type: application/http
Content-Transfer-Encoding: binary
PATCH /('4c47badc-945b-4de9-8067-15f5796f1d44')?StartDate=2024-10-27T07:00:00.000Z&EndDate=2024-12-01T07:59:59.999Z& HTTP/1.1
Accept: application/json, text/javascript, */*; q=0.01
Content-Id: 0
Content-Type: application/json; charset=utf-8
{"Id":"4c47badc-945b-4de9-8067-15f5796f1d44","Subject":"A Recurring Event Editeda","Location":"Everywhere","StartTime":"2024-11-29T11:00:00-08:00","EndTime":"2024-11-29T11:30:00-08:00","IsAllDay":false,"RecurrenceRule":"FREQ=WEEKLY;BYDAY=FR;INTERVAL=1;"}
--changeset_e9b3b1c1-dd4a-4bca-baa4-f805824b9305--
--batch_0b7f39b4-756e-4f70-9b8e-3ba32e68c273--
Here is my scheduler:
<SfSchedule TValue="ScheduledItem" Height="700px">
<ScheduleEventSettings TValue="ScheduledItem">
<SfDataManager Url="http://localhost:5004/odata/ScheduledItems" CrudUrl="http://localhost:5004/odata/ScheduledItems" BatchUrl="http://localhost:5004/odata/ScheduledItems" Adaptor="Adaptors.ODataV4Adaptor" CrossDomain="true"></SfDataManager>
</ScheduleEventSettings>
</SfSchedule>
https://blazor.syncfusion.com/documentation/scheduler/data-binding#url-adaptor
Hi
Tie C,
We have reviewed your query and noticed that you are using the ODataV4Adaptor.
Please confirm whether you have properly configured the ODataAdaptor in the
server-side Program.cs file. For your reference, we have provided the ODataV4Adaptor
documentation and related blogs below. Kindly take a look at the blog shared
below for further clarification.
[Program.cs]
|
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddDbContext<ScheduleDataContext>(options => options.UseInMemoryDatabase("Events")); builder.Services.AddOData(); builder.Services.AddControllersWithViews(); builder.Services.AddRazorPages();
var app = builder.Build();
// Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseWebAssemblyDebugging(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); }
app.UseODataBatching(); app.UseHttpsRedirection();
app.UseBlazorFrameworkFiles(); app.UseStaticFiles();
app.UseRouting();
IEdmModel GetEdmModel() { var odataBuilder = new ODataConventionModelBuilder(); odataBuilder.EntitySet<Appointment>("Appointment"); return odataBuilder.GetEdmModel(); }
app.MapRazorPages(); app.MapControllers(); app.Select().Filter().Expand().OrderBy(); app.MapODataRoute( routeName: "odata", routePrefix: "odata", model: GetEdmModel(), batchHandler: new DefaultODataBatchHandler()); app.MapFallbackToFile("index.html");
app.Run(); |
Blog link: https://www.syncfusion.com/blogs/post/batch-crud-blazor-scheduler-odata
UG link: https://blazor.syncfusion.com/documentation/scheduler/data-binding#binding-with-odata-v4-services
Sample link: https://github.com/SyncfusionExamples/Blazor-Scheduler-CRUD-using-ODATA-adaptor/blob/master/Server/Program.cs
Alternatively, we recommend using a custom adaptor to achieve your
requirements.
UG link: https://blazor.syncfusion.com/documentation/scheduler/data-binding#load-on-demand
Regards,
Vijay
Thank you for your reply. This was indeed my issue. Adding app.UseODataBatching(); fixed the issues I described above.
However, I am still seeing some strange behavior with regard to recurring events. When I try to change a property on single recurring event, instead of making a recurrence exception it is changing the entire recurrence series. I can see that the Scheduler is sending a PATCH request to the server to update the recurring event instead of making a POST batch request to add a recurrence exception and update the existing recurrence entry.
Below is a video that shows the expected behavior in the example you have sent, where changing one item in a recurrence send a POST batch request, and the unexpected behavior I am experiencing, where a PATCH request is being sent and thus updating the entire recurrence entry.
Thank you
Hi Tie C,
We have created a
new forum for the last reported issue. Please follow below forum for further
assistance.
Forum link: ODataV4
server request while editing an recurring event - from 195075 | Blazor Forums |
Syncfusion
Regards,
Vijay
- 3 Replies
- 3 Participants
-
TC Tie C
- Nov 8, 2024 11:05 PM UTC
- Nov 12, 2024 11:54 AM UTC