New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Web API Binding

Updated on Oct 29, 2026

Web API is an application programming interface that uses the HTTP protocol to expose data and operations to clients. The Scheduler can use RESTful HTTP requests to perform remote read, create, update, and destroy operations.

For a runnable example, refer to the demo on Web API binding of the Scheduler component.

Adding a Web API Controller

To support writing and reading data using Web API endpoints, the ControllerBase base class needs to be inherited for a given controller instance.

C#
    [Route("api/[controller]")]
    public class TaskController : Controller
    {
        private readonly ISchedulerEventService<TaskViewModel> service;

        public TaskController(
            ISchedulerEventService<TaskViewModel> schedulerTaskService)
        {
            service = schedulerTaskService;
        }

        // GET api/task
        [HttpGet]
        public DataSourceResult Get([DataSourceRequest]DataSourceRequest request)
        {
            return service.GetAll().ToDataSourceResult(request);
        }

        // POST api/task
        [HttpPost]
        public IActionResult Post(TaskViewModel task)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState.Values.SelectMany(v => v.Errors).Select(error => error.ErrorMessage));
            }

            service.Insert(task, null);

            return new ObjectResult(new DataSourceResult { Data = new[] { task }, Total = 1 });
        }

        // PUT api/task/5
        [HttpPut("{id}")]
        public IActionResult Put(int id, TaskViewModel task)
        {
            if (ModelState.IsValid && id == task.TaskID)
            {
                try
                {
                    service.Update(task, null);
                }
                catch (DbUpdateConcurrencyException)
                {
                    return new NotFoundResult();
                }

                return new StatusCodeResult(200);
            }
            else
            {
                return BadRequest(ModelState.Values.SelectMany(v => v.Errors).Select(error => error.ErrorMessage));
            }
        }

        // DELETE api/task/5
        [HttpDelete("{id}")]
        public IActionResult Delete(int id)
        {
            try
            {
                service.Delete(new TaskViewModel { TaskID = id }, null);
            }
            catch (DbUpdateConcurrencyException)
            {
                return new NotFoundResult();
            }

            return new StatusCodeResult(200);
        }
    }

Configuring the Scheduler DataSource for Web API Binding

To enable the CRUD operations that support Web API Binding, explicitly add a WebApi() configuration method within the DataSource.

Note that a unique identifier for both the Update and Delete operations is passed as a RouteValueDictionary, which is then processed on the server through the HttpMethodAttribute.

Razor
    @(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>()
        .Name("scheduler")
        .Date(new DateTime(2022, 6, 13))
        .StartTime(new DateTime(2022, 6, 13, 7, 00, 00))
        .Height(600)
        .Views(views =>
        {
            views.DayView();
            views.WeekView(weekView => weekView.Selected(true));
            views.MonthView();
            views.AgendaView();
            views.TimelineView();
        })
        .Timezone("Etc/UTC")
        .DataSource(d => d
            .WebApi()
            .Model(m =>
            {
                m.Id(f => f.TaskID);
                m.Field(f => f.Title).DefaultValue("No title");
                m.RecurrenceId(f => f.RecurrenceID);
            })
            .Read(read => read.Action("Get", "Task"))
            .Create(create => create.Action("Post", "Task"))
            .Update(update => update.Action("Put", "Task", new { id = "{0}" })) // Id of the to-be-updated record that will be processed on the server-side.
            .Destroy(destroy => destroy.Action("Delete", "Task", new { id = "{0}" })) // Id of the to-be-deleted record that will be processed on the server-side.
        )
    )

See Also