Web API - Error 405 (Method Not Allowed) for PUT/PATCH on events api

Hi all,

I am developing an API to read/write to an event. I am able to GET an event but when I do a PUT or PATCH, I get error 405 (Method Not Allowed).

I am using dhis2 version 2.33 and using the default admin/district account to communicate with the API


I tried with mergeMode=MERGE&strategy=UPDATE and without them

Is there something I am missing?

Hey @amit ,

PATCH is not supported by /events endpoint, but PUT should work fine. Tracker capture app uses PUT to update event data values.

Another way would be to just POST to /events?mergeMode=merge&strategy=UPDATE. Your json body (event array) should contain events with ids then.


Thank you for your response. Really appreciate it.

I tried POST with ?mergeMode=merge&strategy=UPDATE but I am still getting 405 error

My data format is like this

$data = '{
"events": [{
    "program": "dg7FLdagtvI",
    "event": "CQNH8xYpg1i",
    "dataValues": [{
        "dataElement": "PfKTVVAoklK",
        "value": "AMC94237"


@amit ,

Your payload structure looks correct. Could you share the full URL you are using? The error you are getting would only make sense if you are trying to POST to /events/id, but not /events.



I was sending it to /events/id

sending POST to /events worked but it removed all the other dataElements and just “PfKTVVAoklK” remains now. I just wanted to update this particular dataElement while retaining the rest as it is.

Once again, thank you for your help


How do I just update some of the elements?