Thanks @JanBernitt I had a minimal set of data - the API called via a python-wrapper (dhis2.py)
The error messages I got back where misleading - it claimed that I had not supplied mandatory fields.
The gory details: I sent this org-data:
[{'name': 'Oslo', 'shortName': 'Oslo', 'code': '03', 'openingDate': '1970-01-01T00:00:00.000', 'level': 2, 'parent': {'id': 'hLM62ENwRYD'}}]
(Seemed like a decent subset of information to send - matching what other docs describe)
Below is the error message I got - you will see that it claims not to have received name/shortname etc.
So I (temporary)gave up on the API and created a csv-file to import - but we are going to do ALOT of automated-imports so I would like to use the API.
I realize the error could be in the wrapper, so knowing that the ‘required’ fields are not necessary required helps a lot.
Does anyone savvy recognized the stupid noob-error I might have made? I am just confused by the error message …
[E 240227 10:17:57 orgUnitImport:102] Import failed: code: 409, url: https://test-dhis2.fhi.no/api/organisationUnits?importStrategy=CREATE_AND_UPDATE&identifier=CODE&importMode=VALIDATE&importReportMode=DEBUG, description: {"httpStatus":"Conflict","httpStatusCode":409,"status":"ERROR","message":"One or more errors occurred, please see full details in import report.","response":{"responseType":"ObjectReport","uid":"FOLL4lZKGsl","klass":"org.hisp.dhis.organisationunit.OrganisationUnit","errorReports":[{"message":"Missing required property
name","mainKlass":"org.hisp.dhis.organisationunit.OrganisationUnit","errorCode":"E4000","errorKlass":"java.lang.String","errorProperty":"name","errorProperties":["name"]},{"message":"Missing required property
shortName","mainKlass":"org.hisp.dhis.organisationunit.OrganisationUnit","errorCode":"E4000","errorKlass":"java.lang.String","errorProperty":"shortName","errorProperties":["shortName"]},{"message":"Missing required property
openingDate","mainKlass":"org.hisp.dhis.organisationunit.OrganisationUnit","errorCode":"E4000","errorKlass":"java.util.Date","errorProperty":"openingDate","errorProperties":["openingDate"]}]}}