Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-15 Thread Jason Pickering
Yeah, the loop is probably not required, but was a bit concerned about pulling large amounts of JSON into memory on a small server with no real idea how large things could get. A bit slower, but a bit safer. Will give it a try though. Thanks for all the info and blueprints. Regards, Jason O

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-15 Thread Morten Olav Hansen
Hm, I didn't see that you actually do one page at a time in your code.. yes, paging=false also works ;) the other issues remains though.. -- Morten On Fri, Aug 15, 2014 at 2:30 PM, Jan Henrik Øverland < janhenrik.overl...@gmail.com> wrote: > https://apps.dhis2.org/demo/api/organisationUnits.jso

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-15 Thread Morten Olav Hansen
> > The issue here is that I cannot access/do not have rights to /api/metaData > on the source server, thus the need to use /api/organisationUnits. However > on the destination server we do have rights to /api/metaData. Agree, it > would be easier however. > Ok, I already have an blueprint for thi

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-15 Thread Jan Henrik Øverland
https://apps.dhis2.org/demo/api/organisationUnits.json?*paging=false *? On Fri, Aug 15, 2014 at 9:19 AM, Jason Pickering < jason.p.picker...@gmail.com> wrote: > Hi Morten, > > The issue here is that I cannot access/do not have rights to /api/metaData > on the source server, thus the need to use

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-15 Thread Jason Pickering
Hi Morten, The issue here is that I cannot access/do not have rights to /api/metaData on the source server, thus the need to use /api/organisationUnits. However on the destination server we do have rights to /api/metaData. Agree, it would be easier however. Yeah, leaving the "pager" node in and p

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-14 Thread Morten Olav Hansen
The pager node should be just ignored, you might have other issues though.. if you are using 2.16? I'm still working on it, but the date format is different in /api/metadata vs /api/organisationUnits (or any other type), so you might have issues importing. If you just want "all", you should probab

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-14 Thread Jason Pickering
Just one other question (see attached code). When getting the JSON response from one server, you get a "pager" node. Is there anyway to not get this, or does it even matter if I post it back to "metaData" to the destination server? Reason it has to be done this way, is that we do not have access t

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-14 Thread Morten Olav Hansen
Yeah, just to clarify, every endpoint (except /api/metadata) can only take one single object. If you want to have multiple of one or more types, you will have to post them through /api/metadata endpoint. Good that you got it working :) -- Morten On Fri, Aug 15, 2014 at 11:56 AM, Jason Pickering

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-14 Thread Jason Pickering
Thanks for all the tips and code. Changing "orgunits" to "organisationUnits" and posting to the /metaData endpoint seems to do the trick. Best regards, Jason On Fri, Aug 15, 2014 at 12:11 AM, Jan Henrik Øverland < janhenrik.overl...@gmail.com> wrote: > You are probably aware of this, but if t

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-14 Thread Jan Henrik Øverland
You are probably aware of this, but if there is no particular reason you want to post to api/organisationUnits, it will work with multiple orgunits if you wrap it like this { "organisationUnits": [ ..., ..., ..., ..., etc ] } and post it to api/meta

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-14 Thread Dan Cocos
I don’t think you can post multiple, here’s some PHP code I wrote to add them one by one they all had the same parent so my code is somewhat less complex, you’ll have to have more arrays containing the correct parent and other details for your OUs. http://localhost:8080/api/organisationUnits";$us

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-14 Thread Mark Polak
Jason, I tried to look up if it was possible to post a list and from what i can tell you can’t post a list of objects currently. But Morten would have to clarify that as i am not 100% sure if that is correct. Kind regards, Mark Polak m...@thedutchies.com mar...@ifi.uio.no +31 6 38 600 925 On

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-14 Thread Jason Pickering
Unfortunately, I cannot post it a public list, but I think I may be missing some brackets etc. Basically, I need to sync some orgunits between instances with JSON (after a bit of processing). Will the below work (in theory)? I could not really find an example of POSTing multiple orgunits with JSO

Re: [Dhis2-devs] Attemping to post JSON through the web API

2014-08-14 Thread Mark Polak
Hey Jason, Perhaps it could also be useful if you provide the JSON you’re sending? That might make it easier to figure out why it happened :) Kind regards, Mark Polak m...@thedutchies.com mar...@ifi.uio.no On 14 Aug 2014, at 17:25, Jason Pickering wrote: > Hi Morten, > > I am trying to post

[Dhis2-devs] Attemping to post JSON through the web API

2014-08-14 Thread Jason Pickering
Hi Morten, I am trying to post some JSON to the /api/organisationUnit end point. I think it looks OK (???) but am something does not seem to be right. I see this exception. Could you translate for me? :) Regards, Jason SEVERE: Servlet.service() for servlet [webapi] in context with path [/dhis]