WebAPI : New way to assign an orgUnit to an orgUnitGroup?

Hi All

In older versions of DHIS (pre 2.26), one could assign an OrgUnitGroup to an OrgUnit using the following Ajax call:

var posturl = base + ‘api/organisationUnitGroups/’ + ouGroupUID + ‘/organisationUnits/’ + ouUID + ‘.json’;

$.ajax({

url: posturl,

type: “PUT”,

dataType: “text”,

contentType: “application/json; charset=utf-8”,

async: false,

success: function (response) {

console.log(“OrgUnit Group update successful”);

}

});

Now on 2.27 the WebAPI returns the following response:

{“httpStatus”:“Method Not Allowed”,“httpStatusCode”:405,“status”:“ERROR”,“message”:“Request method ‘PUT’ not supported”}

So what is the solution to achieve the above goal in 2.27?

Regards

···

Farai Mutero

Hi

Have you had a look at our collection API?

https://docs.dhis2.org/master/en/developer/html/webapi_metadata_crud.html#webapi_adding_removing_objects_collections

···

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Fri, Jul 21, 2017 at 12:23 AM, Farai Mutero fmutero@gmail.com wrote:

Hi All

In older versions of DHIS (pre 2.26), one could assign an OrgUnitGroup to an OrgUnit using the following Ajax call:

var posturl = base + ‘api/organisationUnitGroups/’ + ouGroupUID + ‘/organisationUnits/’ + ouUID + ‘.json’;

$.ajax({

url: posturl,

type: “PUT”,

dataType: “text”,

contentType: “application/json; charset=utf-8”,

async: false,

success: function (response) {

console.log(“OrgUnit Group update successful”);

}

});

Now on 2.27 the WebAPI returns the following response:

{“httpStatus”:“Method Not Allowed”,“httpStatusCode”:405,“status”:“ERROR”,“message”:“Request method ‘PUT’ not supported”}

So what is the solution to achieve the above goal in 2.27?

Regards

Farai Mutero


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp