API and python woes ... and suggestions!

Hello all - sorry if I am posting on the wrong channel, but I wanted to share some stuff with you - I am to lazy and shy to fix the errors and write the docs…
It all has to do with using python to call the api to insert data. And maybe with my noobieness or inability to track down the right resources.

I found some errors in the API-docs (assuming I use the right ones … ) and I have some suggestions if the docs are updates.

I also found a bug in the very nice python wrapper for DHIS2 api calls that many have praised (thanks to David Huser!). It has not been updated for a couple of years - do you guys have any other suggestions for wrappers?
You can still use the library, but you need to avoid using import_response_ok for the time being.

Then to the suggestions for api documentation:

  1. I suspect that the api documentation for data values has not been updated for a while - there are many new and cool parameters that can be used - as well as several new values new importStrategy
  2. I suspect that the uid used in the examples are not currently working with the test-database. So the examples are a little hard to check/test. Also, code and name can now be used for many objects - I personally prefer that.
  3. Being new at this, I would absolutely love a little discussion on POST/PUT when using the api. All the examples I have seen are curl examples - so they kinda bypass this. Actually the introduction tells you to use POST to create, and PUT to update - but that is not necessary. Some of the methods for importing data have their own importStrategy - so maybe they ignore POST/PUT?
  4. Speaking of importStrategy, many are undocumented - and I would love to know the difference between for example CREATE_AND_UPDATE NEW_AND_UPDATES . It might very well be that some of them are deprecated but still available for backwards compatibility …

I was very happy to find the DHIS2 wrapper mentioned earlier as it provided me with some examples to get started. It would be great with a section Integrating with Python just as there is one for Integrating with R

Thanks for reading!

3 Likes