← Back to team overview

dhis2-devs team mailing list archive

Unable to update organisation unit attributes by code

 

Hi Devs

I'm trying to update an org unit attributes using it's code.

url to update:-
../organisationUnits?orgUnitIdScheme=CODE&async=true&dryRun=false&importStrategy=UPDATE'

Here is the Json:-

{"organisationUnits":
 [{"code":"999999","attributeValues":[
     {"value":"ATTVALUE","attribute":{"id":"ATTRUID"}},
     {"value":" ATTVALUE ","attribute":{"id":" ATTRUID "}},
     {"value":" ATTVALUE ","attribute":{"id":" ATTRUID "}}]}
 ]}

Error i'm receiving:-

"httpStatus":"Conflict","httpStatusCode":409,"status":"ERROR","message":"One
more more errors occurred, please see full details in import
report.","response":{"responseType":"ObjectReport","errorReports":[{"message":
"*Missing required property `name`*
.","mainKlass":"org.hisp.dhis.organisationunit.OrganisationUnit","errorKlass":"java.lang.String","errorProperty":"name","errorCode":"E4000"},
{"message":
"*Missing required property `shortName`*
.","mainKlass":"org.hisp.dhis.organisationunit.OrganisationUnit","errorKlass":"java.lang.String","errorProperty":"shortName","errorCode":"E4000"},
{"message":
"*Missing required property `openingDate*
`.","mainKlass":"org.hisp.dhis.organisationunit.OrganisationUnit","errorKlass":"java.util.Date","errorProperty":"openingDate","errorCode":"E4000"}],"uid":"OyvGAM7ta51","klass":"org.hisp.dhis.organisationunit.OrganisationUnit"}}

Is it not possible to update the org unit with only the code, Do I have to
add the Name, Shortname and OpeningDate?


DHIS2 ver 2,28
Build revision:8bae670Build date:2018-02-02 06:22


Kind Regards
Pooben

-- 


*This message and any attachments are subject to a disclaimer published at 
http://www.hisp.org/policies.html#comms_disclaimer 
<http://www.hisp.org/policies.html#comms_disclaimer>.  Please read the 
disclaimer before opening any attachment or taking any other action in 
terms of this electronic transmission.  If you cannot access the 
disclaimer, kindly send an email to disclaimer@xxxxxxxx 
<disclaimer@xxxxxxxx> and a copy will be provided to you. By replying to 
this e-mail or opening any attachment you agree to be bound by the 
provisions of the disclaimer.*