Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-19 Thread Isaiah Nyabuto
Hi Jason, Thank you. I wasn't able to post my organisation Units metadata because of the following error. "{\"httpStatus\":\"Internal Server Error\",\"httpStatusCode\":500,\"status\":\"ERROR\",\"message\":\"object references an unsaved transient instance - save the transient instance before

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Isaiah Nyabuto
This is super, I will try and work around that. Thank you. == Isaiah Nyabuto +254729572616 Bsc. Health Records Management and Informatics On Feb 15, 2018 17:10, "Knut Staring" wrote: > Everything done from the user interface is done through the API,

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Knut Staring
Everything done from the user interface is done through the API, so yes. The API also gives you more flexibility to filter etc. The manual describes this. https://docs.dhis2.org/master/en/developer/html/webapi_metadata_crud.html

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Isaiah Nyabuto
Hi Knut, Yes. And is it possible to do that APIs? Thank you. == Isaiah Nyabuto +254729572616 Bsc. Health Records Management and Informatics On Feb 15, 2018 16:29, "Knut Staring" wrote: > Hi Isaiah, > > When you say "extract", you mean you want to

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Knut Staring
Hi Isaiah, When you say "extract", you mean you want to take metadata from one instance of DHIS2 and import to another one? That can be done through the user interface as described in the user manual: https://docs.dhis2.org/master/en/user/html/import_export.html

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Isaiah Nyabuto
Hi Jason, Thank you. I am going to look into that keenly. And If I may ask, is there a way I can extract dhis2 metadata that can be imported directly or with minimal transformations? This will be helpful. Thank you. == Isaiah Nyabuto +254729572616 Bsc. Health Records

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Jason Pickering
Hi Isaiah, You have "parent":"vpiZlB5cdK7" It should be parent":{"id":"vpiZlB5cdK7"}} Be sure your JSON structure is exactly as it should be, otherwise, you will get those kinds of errors. Study the example here

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Isaiah Nyabuto
Thank you for the tip. It still doesn't work. what does this error mean? httr::content(r, "text") [1] "{\"httpStatus\":\"Internal Server Error\",\"httpStatusCode\": 500,\"status\":\"ERROR\",\"message\":\"Can not instantiate value of type [simple type, class

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Jason Pickering
All of your fields must have exactly the correct names: shortname -> shortName featuretype-> featureType Keep hacking at it! You will get there! Regards, Jason On Thu, Feb 15, 2018 at 11:08 AM, Isaiah Nyabuto wrote: > Hi Jason, > > Here is some bit of my post data.

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Isaiah Nyabuto
Hi Jason, Here is some bit of my post data. {"organisationUnits":[{"name":"Wikithuki Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Jason Pickering
Hi Isaiah, Post a bit of your JSON here from toJSON(list(organisationUnits=new_org), auto_unbox = TRUE) One other problem I noticed as well is this [{"name":"Wikithuki Dispensary","uid":"Bc371uxfYD5" It should be [{"name":"Wikithuki Dispensary","id":"Bc371uxfYD5" Regards, Jason On Thu,

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-15 Thread Isaiah Nyabuto
Hi Jason, I get an internal server error code: 500, after trying that. Here is the response; httr::content(r, "text")[1] "{\"httpStatus\":\"Internal Server Error\",\"httpStatusCode\":500,\"status\":\"ERROR\",\"message\":\"Can not instantiate value of type [simple type, class

Re: [Dhis2-users] Posting Metadata in dhis2.

2018-02-14 Thread Jason Pickering
Hi Isiah, The reason for it not working (at least at first glance) is that you are posing to the /api/metadata endpoint. Thus, you need to tell the server what you are trying to import. In this case, its organisation units. I think changing this to r <- POST(url, authenticate(dest.user,

[Dhis2-users] Posting Metadata in dhis2.

2018-02-14 Thread Isaiah Nyabuto
Dear Jason and Dhis2 Community, I am following your guide on bootstrapping dhis2 with R while trying to import metadata using the API. I do not understand why my metadata is not imported. Here are my