Update odata v4 with patch method

2 posts, 0 answers
  1. Martin
    Martin avatar
    5 posts
    Member since:
    May 2016

    Posted 22 Aug Link to this post

    Hi I am able to call my odata controller with the correct key but I am missing the payload, so delta is null.

    How can I set the payload? and also return the updated entity?

    datasource definition:

    var baseUrl = "odata/reports",
                dataSource = new kendo.data.DataSource({
                    type: "odata-v4",
                    transport: {
                        read: {
                            url: baseUrl,
                            dataType: "json"
                        update: {
                            url: (data) => {
                                return baseUrl + "(" + data.models[0].Id + ")";
                            dataType: "json",
                            type: "PATCH"
                        destroy: {
                            url: baseUrl,
                            dataType: "json",
                            type: "DELETE"
                        create: {
                            url: baseUrl,
                            dataType: "json",
                            type: "POST"


    webapi odata controller:

    public IHttpActionResult Patch(int key, Delta<T> delta)

                if (!ModelState.IsValid)
                    return BadRequest(ModelState);

                var entity = Repository.GetByKey(key);
                if (entity == null)
                    return NotFound();

                if (!AuthenticationService.HasWriteAccess(CurentUser, entity))
                    return Unauthorized();

                catch (Exception e)
                    return InternalServerError(e);
                return Updated(entity);

  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    1728 posts

    Posted 24 Aug Link to this post

    Hello Martin,

    Please refer to our Odata 4 with WebAPI controller project which demonstrates how to implement CRUD operations with Kendo UI Grid OData -v4 and web api. 

    Boyan Dimitrov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top