← Back to team overview

dhis2-devs team mailing list archive

Problem Posting to XML to Web API

 

Hi All,

I’m trying to post a simple XML file to create an OU the following is curl call and the contents of the file (ou.xml)

curl -d @ou.xml "https://example.com/api/organistaionUnits"; -X POST -H "Content-Type: application/xml"  -u admin:district

<organisationUnit id="IheTV7ihHgI" level="6" name="Test" shortName="TEST" xmlns="http://dhis2.org/schema/dxf/2.0";>
	<externalAccess>false</externalAccess>
	<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
	<displayName>Test</displayName>
	<parent id="OqNfa8dQ546" />
	<users/>
	<organisationUnitGroups/>
	<children/>
	<dataSets/>
	<attributeValues/>
	<userGroupAccesses/>
</organisationUnit>

The server response is:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException


Does anyone have a working example of posting OUs to the web API?

Thank you,
Dan



Follow ups