Dan
(Dan)
30 June 2015 17:05
1
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
Hi Dan,
I was able to reproduce the issue on our demo server. It seems to be due to the empty attributevalues-element. Removing it caused the import to work as expected. Why this is, however, I do not know. We are currently looking into a separate AttributeValue-related issue with the importer, which could be related.
···
2015-06-30 19:05 GMT+02:00 Dan Cocos dan@dancocos.com :
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
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>Test</displayName>
<parent id="OqNfa8dQ546" />
<users/>
<organisationUnitGroups/>
<children/>
<dataSets/>
<attributeValues/>
<userGroupAccesses/>
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
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
Dan
(Dan)
30 June 2015 17:24
3
Thank you!
I’ve also found that trying to delete OUs via the API causes a 504 Request method ‘DELETE’ not supported
Are we not able to delete OUs via the API?
···
2015-06-30 19:05 GMT+02:00 Dan Cocos dan@dancocos.com :
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
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>Test</displayName>
<parent id="OqNfa8dQ546" />
<users/>
<organisationUnitGroups/>
<children/>
<dataSets/>
<attributeValues/>
<userGroupAccesses/>
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
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
I’m assuming you meant a 405 (method not supported)? A 504 is a gateway timeout, which doesn’t seem applicable.
You should be able to delete orgunits through the same endpoint. Example:
curl -v -X DELETE “https://server/api/organisationUnits/ ” -u user:password
(I tried it on the one i created on the demo. It worked).
···
2015-06-30 19:24 GMT+02:00 Dan Cocos dan@dancocos.com :
Thank you!
I’ve also found that trying to delete OUs via the API causes a 504 Request method ‘DELETE’ not supported
Are we not able to delete OUs via the API?
On Jun 30, 2015, at 1:15 PM, Halvdan Grelland halvdanhg@gmail.com wrote:
Hi Dan,
I was able to reproduce the issue on our demo server. It seems to be due to the empty attributevalues-element. Removing it caused the import to work as expected. Why this is, however, I do not know. We are currently looking into a separate AttributeValue-related issue with the importer, which could be related.
Att: Morten:
The interesting part of the stack trace:
root cause
java.lang.NullPointerException
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImporter.java:1121)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:944)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.newObject(DefaultIdentifiableObjectImporter.java:305)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.startImport(DefaultIdentifiableObjectImporter.java:525)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjectLocal(DefaultIdentifiableObjectImporter.java:511)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObject(DefaultIdentifiableObjectImporter.java:210)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObject(DefaultIdentifiableObjectImporter.java:102)
org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImportService.java:281)
org.hisp.dhis.dxf2.metadata.DefaultImportService.importObject(DefaultImportService.java:115)
Regards,
Halvdan
2015-06-30 19:05 GMT+02:00 Dan Cocos dan@dancocos.com :
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
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>Test</displayName>
<parent id="OqNfa8dQ546" />
<users/>
<organisationUnitGroups/>
<children/>
<dataSets/>
<attributeValues/>
<userGroupAccesses/>
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
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
Dan
(Dan)
30 June 2015 17:44
5
I still get an error when I try with the following, I’ve attached a copy of the complete stack trace.
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>BAO Test</displayName>
<parent id="Iu06qlak3ZY" />
or this
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>BAO Test</displayName>
<parent id="OqNfa8dQ546" />
<users/>
<organisationUnitGroups/>
<children/>
<dataSets/>
<userGroupAccesses/>
I am unable to reproduce the issue on the 2.19 demo server. What version are you on?
The stack trace you’ve provided is unfortunately pretty sparse. Could you have a look in the tomcat log and see if there’s some more? There’s nothing pointing at the actual root cause in this one.
···
2015-06-30 19:44 GMT+02:00 Dan Cocos dan@dancocos.com :
I still get an error when I try with the following, I’ve attached a copy of the complete stack trace.
false
2015-05-20T23:00:00.000+0000
BAO Test
or this
false
2015-05-20T23:00:00.000+0000
BAO Test
On Jun 30, 2015, at 1:24 PM, Dan Cocos dan@dancocos.com wrote:
Thank you!
I’ve also found that trying to delete OUs via the API causes a 504 Request method ‘DELETE’ not supported
Are we not able to delete OUs via the API?
On Jun 30, 2015, at 1:15 PM, Halvdan Grelland halvdanhg@gmail.com wrote:
Hi Dan,
I was able to reproduce the issue on our demo server. It seems to be due to the empty attributevalues-element. Removing it caused the import to work as expected. Why this is, however, I do not know. We are currently looking into a separate AttributeValue-related issue with the importer, which could be related.
Att: Morten:
The interesting part of the stack trace:
root cause
java.lang.NullPointerException
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImporter.java:1121)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:944)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.newObject(DefaultIdentifiableObjectImporter.java:305)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.startImport(DefaultIdentifiableObjectImporter.java:525)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjectLocal(DefaultIdentifiableObjectImporter.java:511)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObject(DefaultIdentifiableObjectImporter.java:210)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObject(DefaultIdentifiableObjectImporter.java:102)
org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImportService.java:281)
org.hisp.dhis.dxf2.metadata.DefaultImportService.importObject(DefaultImportService.java:115)
Regards,
Halvdan
2015-06-30 19:05 GMT+02:00 Dan Cocos dan@dancocos.com :
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
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>Test</displayName>
<parent id="OqNfa8dQ546" />
<users/>
<organisationUnitGroups/>
<children/>
<dataSets/>
<attributeValues/>
<userGroupAccesses/>
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
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
Dan
(Dan)
30 June 2015 19:15
7
To follow up I just discovered why it wasn’t working I had a typo in the URL, though the error was a bit misleading.
···
2015-06-30 19:05 GMT+02:00 Dan Cocos dan@dancocos.com :
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
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>Test</displayName>
<parent id="OqNfa8dQ546" />
<users/>
<organisationUnitGroups/>
<children/>
<dataSets/>
<attributeValues/>
<userGroupAccesses/>
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
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
Ok. It would be good to know the typo in question. Doesn’t seem like a reasonable response for a misspelled url.
···
2015-06-30 21:15 GMT+02:00 Dan Cocos dan@dancocos.com :
To follow up I just discovered why it wasn’t working I had a typo in the URL, though the error was a bit misleading.
On Jun 30, 2015, at 1:44 PM, Dan Cocos dan@dancocos.com wrote:
I still get an error when I try with the following, I’ve attached a copy of the complete stack trace.
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>BAO Test</displayName>
<parent id="Iu06qlak3ZY" />
or this
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>BAO Test</displayName>
<parent id="OqNfa8dQ546" />
<users/>
<organisationUnitGroups/>
<children/>
<dataSets/>
<userGroupAccesses/>
<error.html>
On Jun 30, 2015, at 1:24 PM, Dan Cocos dan@dancocos.com wrote:
Thank you!
I’ve also found that trying to delete OUs via the API causes a 504 Request method ‘DELETE’ not supported
Are we not able to delete OUs via the API?
On Jun 30, 2015, at 1:15 PM, Halvdan Grelland halvdanhg@gmail.com wrote:
Hi Dan,
I was able to reproduce the issue on our demo server. It seems to be due to the empty attributevalues-element. Removing it caused the import to work as expected. Why this is, however, I do not know. We are currently looking into a separate AttributeValue-related issue with the importer, which could be related.
Att: Morten:
The interesting part of the stack trace:
root cause
java.lang.NullPointerException
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImporter.java:1121)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:944)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.newObject(DefaultIdentifiableObjectImporter.java:305)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.startImport(DefaultIdentifiableObjectImporter.java:525)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjectLocal(DefaultIdentifiableObjectImporter.java:511)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObject(DefaultIdentifiableObjectImporter.java:210)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObject(DefaultIdentifiableObjectImporter.java:102)
org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImportService.java:281)
org.hisp.dhis.dxf2.metadata.DefaultImportService.importObject(DefaultImportService.java:115)
Regards,
Halvdan
2015-06-30 19:05 GMT+02:00 Dan Cocos dan@dancocos.com :
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
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>Test</displayName>
<parent id="OqNfa8dQ546" />
<users/>
<organisationUnitGroups/>
<children/>
<dataSets/>
<attributeValues/>
<userGroupAccesses/>
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
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
morten
(Morten Hansen)
1 July 2015 02:43
9
Hi
Please be aware that there are differences from JSON to XML here. An empty collection in JSON is set to empty, but an empty collection in xml is set to -null-, so please never include an empty collection if you are using XML.
···
On Wed, Jul 1, 2015 at 2:22 AM, Halvdan Grelland halvdanhg@gmail.com wrote:
Ok. It would be good to know the typo in question. Doesn’t seem like a reasonable response for a misspelled url.
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
–
Morten
2015-06-30 21:15 GMT+02:00 Dan Cocos dan@dancocos.com :
To follow up I just discovered why it wasn’t working I had a typo in the URL, though the error was a bit misleading.
On Jun 30, 2015, at 1:44 PM, Dan Cocos dan@dancocos.com wrote:
I still get an error when I try with the following, I’ve attached a copy of the complete stack trace.
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>BAO Test</displayName>
<parent id="Iu06qlak3ZY" />
or this
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>BAO Test</displayName>
<parent id="OqNfa8dQ546" />
<users/>
<organisationUnitGroups/>
<children/>
<dataSets/>
<userGroupAccesses/>
<error.html>
On Jun 30, 2015, at 1:24 PM, Dan Cocos dan@dancocos.com wrote:
Thank you!
I’ve also found that trying to delete OUs via the API causes a 504 Request method ‘DELETE’ not supported
Are we not able to delete OUs via the API?
On Jun 30, 2015, at 1:15 PM, Halvdan Grelland halvdanhg@gmail.com wrote:
Hi Dan,
I was able to reproduce the issue on our demo server. It seems to be due to the empty attributevalues-element. Removing it caused the import to work as expected. Why this is, however, I do not know. We are currently looking into a separate AttributeValue-related issue with the importer, which could be related.
Att: Morten:
The interesting part of the stack trace:
root cause
java.lang.NullPointerException
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImporter.java:1121)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:944)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.newObject(DefaultIdentifiableObjectImporter.java:305)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.startImport(DefaultIdentifiableObjectImporter.java:525)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjectLocal(DefaultIdentifiableObjectImporter.java:511)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObject(DefaultIdentifiableObjectImporter.java:210)
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObject(DefaultIdentifiableObjectImporter.java:102)
org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImportService.java:281)
org.hisp.dhis.dxf2.metadata.DefaultImportService.importObject(DefaultImportService.java:115)
Regards,
Halvdan
2015-06-30 19:05 GMT+02:00 Dan Cocos dan@dancocos.com :
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
<externalAccess>false</externalAccess>
<openingDate>2015-05-20T23:00:00.000+0000</openingDate>
<displayName>Test</displayName>
<parent id="OqNfa8dQ546" />
<users/>
<organisationUnitGroups/>
<children/>
<dataSets/>
<attributeValues/>
<userGroupAccesses/>
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
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