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 flushing: org.hisp.dhis.organisationunit.OrganisationUnit\"}"

I wish I knew how to solve that through the API. However, I imported the
organisation units using the csv file import. I followed along your guide
and I was able to post all other metadata and data values - Thank you.




On Thu, Feb 15, 2018 at 3:33 PM, Isaiah Nyabuto 
wrote:

> 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 Management and Informatics
>
> On Feb 15, 2018 15:16, "Jason Pickering" 
> wrote:
>
>> 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
>> 
>> .
>>
>> Regards,
>> Jason
>>
>>
>>
>> On Thu, Feb 15, 2018 at 1:07 PM, Isaiah Nyabuto 
>> wrote:
>>
>>> 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 org.hisp.dhis.organisationunit.OrganisationUnit]
>>> from String value ('It7fWcKbcZX'); no single-String constructor/factory
>>> method\\n at [Source: org.apache.catalina.connector.
>>> CoyoteInputStream@1efec811; line: 1, column: 73] (through reference
>>> chain: org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\
>>> "])\"}"
>>>
>>> Anyone?
>>>
>>> Thank you.
>>> ==
>>> Isaiah Nyabuto
>>> +254729572616 <+254%20729%20572616>
>>> Bsc. Health Records Management and Informatics
>>>
>>> On Feb 15, 2018 13:14, "Jason Pickering" 
>>> wrote:
>>>
>>> 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 <
>>> isaiahnyab...@gmail.com> wrote:
>>>
 Hi Jason,

 Here is some bit of my post data.

 {"organisationUnits":[{"name":"Wikithuki 
 Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
  
 Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
  Medical 
 Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
  Medical 
 Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
  Community Health 
 Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
  CHU","description":"Community 
 Unit","comment":"","featuretype":"NONE","coordinates":"[34.46411,0.19358]","url":""},{"name":"Gatunga
  Health Centre","uid":"cmay4WXRmhA","code":"12034","parent":


 After changing the "uid" to "id",  still it doesn't work.

 Thank you


 On Thu, Feb 15, 2018 at 12:14 PM, Jason Pickering <
 jason.p.picker...@gmail.com> wrote:

> 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, Feb 15, 2018 at 10:01 AM, Isaiah Nyabuto <
> isaiahnyab...@gmail.com> wrote:
>
>> 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 
>> org.hisp.dhis.organisationunit.OrganisationUnit] from String 

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, 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
> https://docs.dhis2.org/master/en/developer/html/webapi_
> metadata_export.html
> https://docs.dhis2.org/master/en/developer/html/webapi_
> metadata_synchronization.html
>
>
> On Thu, Feb 15, 2018 at 8:56 AM, Isaiah Nyabuto 
> wrote:
>
>>
>> Hi Knut,
>>
>> Yes. And is it possible to do that APIs?
>>
>> Thank you.
>>
>>
>> ==
>> Isaiah Nyabuto
>> +254729572616 <+254%20729%20572616>
>> 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 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
>>> https://play.dhis2.org/2.28/dhis-web-importexport/index.action
>>>
>>> You can also load metadata from CSV:
>>> https://docs.dhis2.org/master/en/developer/html/webapi_csv_m
>>> etadata_import.html
>>>
>>> On Thu, Feb 15, 2018 at 7:33 AM, Isaiah Nyabuto >> > wrote:
>>>
 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 <+254%20729%20572616>
 Bsc. Health Records Management and Informatics

 On Feb 15, 2018 15:16, "Jason Pickering" 
 wrote:

> 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
> 
> .
>
> Regards,
> Jason
>
>
>
> On Thu, Feb 15, 2018 at 1:07 PM, Isaiah Nyabuto <
> isaiahnyab...@gmail.com> wrote:
>
>> 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 org.hisp.dhis.organisationunit.OrganisationUnit]
>> from String value ('It7fWcKbcZX'); no single-String constructor/factory
>> method\\n at [Source: org.apache.catalina.connector.
>> CoyoteInputStream@1efec811; line: 1, column: 73] (through reference
>> chain: org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\
>> "])\"}"
>>
>> Anyone?
>>
>> Thank you.
>> ==
>> Isaiah Nyabuto
>> +254729572616 <+254%20729%20572616>
>> Bsc. Health Records Management and Informatics
>>
>> On Feb 15, 2018 13:14, "Jason Pickering" 
>> wrote:
>>
>> 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 <
>> isaiahnyab...@gmail.com> wrote:
>>
>>> Hi Jason,
>>>
>>> Here is some bit of my post data.
>>>
>>> {"organisationUnits":[{"name":"Wikithuki 
>>> Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
>>>  
>>> Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
>>>  Medical 
>>> Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
>>>  Medical 
>>> Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
>>>  Community Health 
>>> Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
>>>  CHU","description":"Community 
>>> 

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
https://docs.dhis2.org/master/en/developer/html/webapi_metadata_export.html
https://docs.dhis2.org/master/en/developer/html/webapi_metadata_synchronization.html


On Thu, Feb 15, 2018 at 8:56 AM, Isaiah Nyabuto 
wrote:

>
> Hi Knut,
>
> Yes. And is it possible to do that APIs?
>
> Thank you.
>
>
> ==
> Isaiah Nyabuto
> +254729572616 <+254%20729%20572616>
> 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 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
>> https://play.dhis2.org/2.28/dhis-web-importexport/index.action
>>
>> You can also load metadata from CSV:
>> https://docs.dhis2.org/master/en/developer/html/webapi_csv_m
>> etadata_import.html
>>
>> On Thu, Feb 15, 2018 at 7:33 AM, Isaiah Nyabuto 
>> wrote:
>>
>>> 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 <+254%20729%20572616>
>>> Bsc. Health Records Management and Informatics
>>>
>>> On Feb 15, 2018 15:16, "Jason Pickering" 
>>> wrote:
>>>
 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
 
 .

 Regards,
 Jason



 On Thu, Feb 15, 2018 at 1:07 PM, Isaiah Nyabuto <
 isaiahnyab...@gmail.com> wrote:

> 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 org.hisp.dhis.organisationunit.OrganisationUnit]
> from String value ('It7fWcKbcZX'); no single-String constructor/factory
> method\\n at [Source: org.apache.catalina.connector.
> CoyoteInputStream@1efec811; line: 1, column: 73] (through reference
> chain: org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\
> "])\"}"
>
> Anyone?
>
> Thank you.
> ==
> Isaiah Nyabuto
> +254729572616 <+254%20729%20572616>
> Bsc. Health Records Management and Informatics
>
> On Feb 15, 2018 13:14, "Jason Pickering" 
> wrote:
>
> 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 <
> isaiahnyab...@gmail.com> wrote:
>
>> Hi Jason,
>>
>> Here is some bit of my post data.
>>
>> {"organisationUnits":[{"name":"Wikithuki 
>> Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
>>  
>> Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
>>  Medical 
>> Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
>>  Medical 
>> Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
>>  Community Health 
>> Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
>>  CHU","description":"Community 
>> Unit","comment":"","featuretype":"NONE","coordinates":"[34.46411,0.19358]","url":""},{"name":"Gatunga
>>  Health Centre","uid":"cmay4WXRmhA","code":"12034","parent":
>>
>>
>> After changing the "uid" to "id",  still it doesn't work.
>>
>> Thank you
>>
>>
>> On Thu, Feb 15, 2018 at 12:14 PM, Jason Pickering <
>> jason.p.picker...@gmail.com> wrote:
>>

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 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
> https://play.dhis2.org/2.28/dhis-web-importexport/index.action
>
> You can also load metadata from CSV:
> https://docs.dhis2.org/master/en/developer/html/webapi_csv_
> metadata_import.html
>
> On Thu, Feb 15, 2018 at 7:33 AM, Isaiah Nyabuto 
> wrote:
>
>> 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 <+254%20729%20572616>
>> Bsc. Health Records Management and Informatics
>>
>> On Feb 15, 2018 15:16, "Jason Pickering" 
>> wrote:
>>
>>> 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
>>> 
>>> .
>>>
>>> Regards,
>>> Jason
>>>
>>>
>>>
>>> On Thu, Feb 15, 2018 at 1:07 PM, Isaiah Nyabuto >> > wrote:
>>>
 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 org.hisp.dhis.organisationunit.OrganisationUnit]
 from String value ('It7fWcKbcZX'); no single-String constructor/factory
 method\\n at [Source: org.apache.catalina.connector.
 CoyoteInputStream@1efec811; line: 1, column: 73] (through reference
 chain: org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\
 "])\"}"

 Anyone?

 Thank you.
 ==
 Isaiah Nyabuto
 +254729572616 <+254%20729%20572616>
 Bsc. Health Records Management and Informatics

 On Feb 15, 2018 13:14, "Jason Pickering" 
 wrote:

 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 <
 isaiahnyab...@gmail.com> wrote:

> Hi Jason,
>
> Here is some bit of my post data.
>
> {"organisationUnits":[{"name":"Wikithuki 
> Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
>  
> Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
>  Medical 
> Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
>  Medical 
> Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
>  Community Health 
> Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
>  CHU","description":"Community 
> Unit","comment":"","featuretype":"NONE","coordinates":"[34.46411,0.19358]","url":""},{"name":"Gatunga
>  Health Centre","uid":"cmay4WXRmhA","code":"12034","parent":
>
>
> After changing the "uid" to "id",  still it doesn't work.
>
> Thank you
>
>
> On Thu, Feb 15, 2018 at 12:14 PM, Jason Pickering <
> jason.p.picker...@gmail.com> wrote:
>
>> 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, Feb 15, 2018 at 10:01 AM, Isaiah Nyabuto <
>> isaiahnyab...@gmail.com> wrote:
>>
>>> Hi Jason,
>>>
>>> I get an internal server error code: 500, after trying that. Here is
>>> the 

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
https://play.dhis2.org/2.28/dhis-web-importexport/index.action

You can also load metadata from CSV:
https://docs.dhis2.org/master/en/developer/html/webapi_csv_metadata_import.html

On Thu, Feb 15, 2018 at 7:33 AM, Isaiah Nyabuto 
wrote:

> 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 <+254%20729%20572616>
> Bsc. Health Records Management and Informatics
>
> On Feb 15, 2018 15:16, "Jason Pickering" 
> wrote:
>
>> 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
>> 
>> .
>>
>> Regards,
>> Jason
>>
>>
>>
>> On Thu, Feb 15, 2018 at 1:07 PM, Isaiah Nyabuto 
>> wrote:
>>
>>> 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 org.hisp.dhis.organisationunit.OrganisationUnit]
>>> from String value ('It7fWcKbcZX'); no single-String constructor/factory
>>> method\\n at [Source: org.apache.catalina.connector.
>>> CoyoteInputStream@1efec811; line: 1, column: 73] (through reference
>>> chain: org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\
>>> "])\"}"
>>>
>>> Anyone?
>>>
>>> Thank you.
>>> ==
>>> Isaiah Nyabuto
>>> +254729572616 <+254%20729%20572616>
>>> Bsc. Health Records Management and Informatics
>>>
>>> On Feb 15, 2018 13:14, "Jason Pickering" 
>>> wrote:
>>>
>>> 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 <
>>> isaiahnyab...@gmail.com> wrote:
>>>
 Hi Jason,

 Here is some bit of my post data.

 {"organisationUnits":[{"name":"Wikithuki 
 Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
  
 Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
  Medical 
 Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
  Medical 
 Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
  Community Health 
 Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
  CHU","description":"Community 
 Unit","comment":"","featuretype":"NONE","coordinates":"[34.46411,0.19358]","url":""},{"name":"Gatunga
  Health Centre","uid":"cmay4WXRmhA","code":"12034","parent":


 After changing the "uid" to "id",  still it doesn't work.

 Thank you


 On Thu, Feb 15, 2018 at 12:14 PM, Jason Pickering <
 jason.p.picker...@gmail.com> wrote:

> 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, Feb 15, 2018 at 10:01 AM, Isaiah Nyabuto <
> isaiahnyab...@gmail.com> wrote:
>
>> 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 
>> org.hisp.dhis.organisationunit.OrganisationUnit] from String value 
>> ('It7fWcKbcZX'); no single-String constructor/factory method\\n at 
>> [Source: 

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 Management and Informatics

On Feb 15, 2018 15:16, "Jason Pickering" 
wrote:

> 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
> 
> .
>
> Regards,
> Jason
>
>
>
> On Thu, Feb 15, 2018 at 1:07 PM, Isaiah Nyabuto 
> wrote:
>
>> 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 org.hisp.dhis.organisationunit.OrganisationUnit]
>> from String value ('It7fWcKbcZX'); no single-String constructor/factory
>> method\\n at [Source: org.apache.catalina.connector.
>> CoyoteInputStream@1efec811; line: 1, column: 73] (through reference
>> chain: org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\
>> "])\"}"
>>
>> Anyone?
>>
>> Thank you.
>> ==
>> Isaiah Nyabuto
>> +254729572616 <+254%20729%20572616>
>> Bsc. Health Records Management and Informatics
>>
>> On Feb 15, 2018 13:14, "Jason Pickering" 
>> wrote:
>>
>> 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.
>>>
>>> {"organisationUnits":[{"name":"Wikithuki 
>>> Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
>>>  
>>> Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
>>>  Medical 
>>> Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
>>>  Medical 
>>> Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
>>>  Community Health 
>>> Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
>>>  CHU","description":"Community 
>>> Unit","comment":"","featuretype":"NONE","coordinates":"[34.46411,0.19358]","url":""},{"name":"Gatunga
>>>  Health Centre","uid":"cmay4WXRmhA","code":"12034","parent":
>>>
>>>
>>> After changing the "uid" to "id",  still it doesn't work.
>>>
>>> Thank you
>>>
>>>
>>> On Thu, Feb 15, 2018 at 12:14 PM, Jason Pickering <
>>> jason.p.picker...@gmail.com> wrote:
>>>
 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, Feb 15, 2018 at 10:01 AM, Isaiah Nyabuto <
 isaiahnyab...@gmail.com> wrote:

> 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 
> org.hisp.dhis.organisationunit.OrganisationUnit] from String value 
> ('It7fWcKbcZX'); no single-String constructor/factory method\\n at 
> [Source: org.apache.catalina.connector.CoyoteInputStream@1efec811; line: 
> 1, column: 73] (through reference chain: 
> org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\"])\"}"
>
>
> Thank you.
>
> On Thu, Feb 15, 2018 at 10:36 AM, Jason Pickering <
> jason.p.picker...@gmail.com> wrote:
>
>> 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, dest.pass),
>>  

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

.

Regards,
Jason



On Thu, Feb 15, 2018 at 1:07 PM, Isaiah Nyabuto 
wrote:

> 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 org.hisp.dhis.organisationunit.OrganisationUnit] from
> String value ('It7fWcKbcZX'); no single-String constructor/factory
> method\\n at [Source: org.apache.catalina.connector.
> CoyoteInputStream@1efec811; line: 1, column: 73] (through reference
> chain: org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\
> "])\"}"
>
> Anyone?
>
> Thank you.
> ==
> Isaiah Nyabuto
> +254729572616 <+254%20729%20572616>
> Bsc. Health Records Management and Informatics
>
> On Feb 15, 2018 13:14, "Jason Pickering" 
> wrote:
>
> 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.
>>
>> {"organisationUnits":[{"name":"Wikithuki 
>> Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
>>  
>> Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
>>  Medical 
>> Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
>>  Medical 
>> Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
>>  Community Health 
>> Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
>>  CHU","description":"Community 
>> Unit","comment":"","featuretype":"NONE","coordinates":"[34.46411,0.19358]","url":""},{"name":"Gatunga
>>  Health Centre","uid":"cmay4WXRmhA","code":"12034","parent":
>>
>>
>> After changing the "uid" to "id",  still it doesn't work.
>>
>> Thank you
>>
>>
>> On Thu, Feb 15, 2018 at 12:14 PM, Jason Pickering <
>> jason.p.picker...@gmail.com> wrote:
>>
>>> 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, Feb 15, 2018 at 10:01 AM, Isaiah Nyabuto <
>>> isaiahnyab...@gmail.com> wrote:
>>>
 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 
 org.hisp.dhis.organisationunit.OrganisationUnit] from String value 
 ('It7fWcKbcZX'); no single-String constructor/factory method\\n at 
 [Source: org.apache.catalina.connector.CoyoteInputStream@1efec811; line: 
 1, column: 73] (through reference chain: 
 org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\"])\"}"


 Thank you.

 On Thu, Feb 15, 2018 at 10:36 AM, Jason Pickering <
 jason.p.picker...@gmail.com> wrote:

> 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, dest.pass),
> body = toJSON(list(organisationUnits=new_org), auto_unbox
> = TRUE),
> content_type_json())
>
> should work.
>
> The example works because the file
> 
> looks like this:
>
>
> {"created":"2016-08-10","organisationUnits":[{"id":"u6yjgvIMzKn",...
>
>
> Hope this helps and best regards,
>
> Jason
>
>
>
>
>
> On Thu, Feb 15, 2018 at 6:34 AM, Isaiah Nyabuto <
> 

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 org.hisp.dhis.organisationunit.OrganisationUnit] from
String value ('It7fWcKbcZX'); no single-String constructor/factory
method\\n at [Source: org.apache.catalina.connector.
CoyoteInputStream@1efec811; line: 1, column: 73] (through reference chain:
org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\"])\"}"

Anyone?

Thank you.
==
Isaiah Nyabuto
+254729572616
Bsc. Health Records Management and Informatics

On Feb 15, 2018 13:14, "Jason Pickering" 
wrote:

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.
>
> {"organisationUnits":[{"name":"Wikithuki 
> Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
>  
> Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
>  Medical 
> Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
>  Medical 
> Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
>  Community Health 
> Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
>  CHU","description":"Community 
> Unit","comment":"","featuretype":"NONE","coordinates":"[34.46411,0.19358]","url":""},{"name":"Gatunga
>  Health Centre","uid":"cmay4WXRmhA","code":"12034","parent":
>
>
> After changing the "uid" to "id",  still it doesn't work.
>
> Thank you
>
>
> On Thu, Feb 15, 2018 at 12:14 PM, Jason Pickering <
> jason.p.picker...@gmail.com> wrote:
>
>> 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, Feb 15, 2018 at 10:01 AM, Isaiah Nyabuto > > wrote:
>>
>>> 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 
>>> org.hisp.dhis.organisationunit.OrganisationUnit] from String value 
>>> ('It7fWcKbcZX'); no single-String constructor/factory method\\n at [Source: 
>>> org.apache.catalina.connector.CoyoteInputStream@1efec811; line: 1, column: 
>>> 73] (through reference chain: 
>>> org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\"])\"}"
>>>
>>>
>>> Thank you.
>>>
>>> On Thu, Feb 15, 2018 at 10:36 AM, Jason Pickering <
>>> jason.p.picker...@gmail.com> wrote:
>>>
 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, dest.pass),
 body = toJSON(list(organisationUnits=new_org), auto_unbox
 = TRUE),
 content_type_json())

 should work.

 The example works because the file
 
 looks like this:


 {"created":"2016-08-10","organisationUnits":[{"id":"u6yjgvIMzKn",...


 Hope this helps and best regards,

 Jason





 On Thu, Feb 15, 2018 at 6:34 AM, Isaiah Nyabuto <
 isaiahnyab...@gmail.com> wrote:

>
> 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
> steps, any help will be appreciated.
>
>
> head(org)  name uid   code  parent
>  shortname
> 1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7  

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.
>
> {"organisationUnits":[{"name":"Wikithuki 
> Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
>  
> Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
>  Medical 
> Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
>  Medical 
> Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
>  Community Health 
> Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
>  CHU","description":"Community 
> Unit","comment":"","featuretype":"NONE","coordinates":"[34.46411,0.19358]","url":""},{"name":"Gatunga
>  Health Centre","uid":"cmay4WXRmhA","code":"12034","parent":
>
>
> After changing the "uid" to "id",  still it doesn't work.
>
> Thank you
>
>
> On Thu, Feb 15, 2018 at 12:14 PM, Jason Pickering <
> jason.p.picker...@gmail.com> wrote:
>
>> 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, Feb 15, 2018 at 10:01 AM, Isaiah Nyabuto > > wrote:
>>
>>> 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 
>>> org.hisp.dhis.organisationunit.OrganisationUnit] from String value 
>>> ('It7fWcKbcZX'); no single-String constructor/factory method\\n at [Source: 
>>> org.apache.catalina.connector.CoyoteInputStream@1efec811; line: 1, column: 
>>> 73] (through reference chain: 
>>> org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\"])\"}"
>>>
>>>
>>> Thank you.
>>>
>>> On Thu, Feb 15, 2018 at 10:36 AM, Jason Pickering <
>>> jason.p.picker...@gmail.com> wrote:
>>>
 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, dest.pass),
 body = toJSON(list(organisationUnits=new_org), auto_unbox
 = TRUE),
 content_type_json())

 should work.

 The example works because the file
 
 looks like this:


 {"created":"2016-08-10","organisationUnits":[{"id":"u6yjgvIMzKn",...


 Hope this helps and best regards,

 Jason





 On Thu, Feb 15, 2018 at 6:34 AM, Isaiah Nyabuto <
 isaiahnyab...@gmail.com> wrote:

>
> 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
> steps, any help will be appreciated.
>
>
> head(org)  name uid   code  parent
>  shortname
> 1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7  Wikithuki 
> Dispensary
> 2Gemifa Medical Clinic Z7Lf1n3Fcpi  22907 mEZBjj4fLBT 
>Gemifa
> 3   Olympus Medical Clinic NAbQdHuaJFK  22906 PeEcMfBchbr 
>   Olympus
> 4 Masaba Community Health Unit tYwHeLSnHyb 600616 QR2K4k8VKF1
> Masaba CHU
> 5Gatunga Health Centre cmay4WXRmhA  12034 IcAegRcGuV6 Gatunga 
> Health Centre
> 6 Cfw Kimangaru Clinic E52UsoBxJVS  11966 vEAFtHnPDrX  CFW 
> Kimangaru Clinic
>  description openingdate closedate comment featuretype  
> coordinates url
> 1 NANA   POINT  
> [37.95263,-0.77819]
> 2 Clinic  NANANONE 
> 

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
Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
Medical 
Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
Medical 
Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
Community Health
Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
CHU","description":"Community
Unit","comment":"","featuretype":"NONE","coordinates":"[34.46411,0.19358]","url":""},{"name":"Gatunga
Health Centre","uid":"cmay4WXRmhA","code":"12034","parent":


After changing the "uid" to "id",  still it doesn't work.

Thank you


On Thu, Feb 15, 2018 at 12:14 PM, Jason Pickering <
jason.p.picker...@gmail.com> wrote:

> 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, Feb 15, 2018 at 10:01 AM, Isaiah Nyabuto 
> wrote:
>
>> 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 
>> org.hisp.dhis.organisationunit.OrganisationUnit] from String value 
>> ('It7fWcKbcZX'); no single-String constructor/factory method\\n at [Source: 
>> org.apache.catalina.connector.CoyoteInputStream@1efec811; line: 1, column: 
>> 73] (through reference chain: 
>> org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\"])\"}"
>>
>>
>> Thank you.
>>
>> On Thu, Feb 15, 2018 at 10:36 AM, Jason Pickering <
>> jason.p.picker...@gmail.com> wrote:
>>
>>> 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, dest.pass),
>>> body = toJSON(list(organisationUnits=new_org), auto_unbox =
>>> TRUE),
>>> content_type_json())
>>>
>>> should work.
>>>
>>> The example works because the file
>>> 
>>> looks like this:
>>>
>>>
>>> {"created":"2016-08-10","organisationUnits":[{"id":"u6yjgvIMzKn",...
>>>
>>>
>>> Hope this helps and best regards,
>>>
>>> Jason
>>>
>>>
>>>
>>>
>>>
>>> On Thu, Feb 15, 2018 at 6:34 AM, Isaiah Nyabuto >> > wrote:
>>>

 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 steps,
 any help will be appreciated.


 head(org)  name uid   code  parent 
 shortname
 1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7  Wikithuki 
 Dispensary
 2Gemifa Medical Clinic Z7Lf1n3Fcpi  22907 mEZBjj4fLBT  
   Gemifa
 3   Olympus Medical Clinic NAbQdHuaJFK  22906 PeEcMfBchbr  
  Olympus
 4 Masaba Community Health Unit tYwHeLSnHyb 600616 QR2K4k8VKF1
 Masaba CHU
 5Gatunga Health Centre cmay4WXRmhA  12034 IcAegRcGuV6 Gatunga 
 Health Centre
 6 Cfw Kimangaru Clinic E52UsoBxJVS  11966 vEAFtHnPDrX  CFW 
 Kimangaru Clinic
  description openingdate closedate comment featuretype  
 coordinates url
 1 NANA   POINT  
 [37.95263,-0.77819]
 2 Clinic  NANANONE 
 [34.391914,0.059575]
 3 Clinic  NANANONE   
 [34.3994,0.059575]
 4 Community Unit  NANANONE   
 [34.46411,0.19358]
 5 NANA   POINT   
 [37.9423,-0.29656]
 6 NANA   POINT  
 [37.53009,-0.54506]
   contactperson address email 

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, Feb 15, 2018 at 10:01 AM, Isaiah Nyabuto 
wrote:

> 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 
> org.hisp.dhis.organisationunit.OrganisationUnit] from String value 
> ('It7fWcKbcZX'); no single-String constructor/factory method\\n at [Source: 
> org.apache.catalina.connector.CoyoteInputStream@1efec811; line: 1, column: 
> 73] (through reference chain: 
> org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\"])\"}"
>
>
> Thank you.
>
> On Thu, Feb 15, 2018 at 10:36 AM, Jason Pickering <
> jason.p.picker...@gmail.com> wrote:
>
>> 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, dest.pass),
>> body = toJSON(list(organisationUnits=new_org), auto_unbox =
>> TRUE),
>> content_type_json())
>>
>> should work.
>>
>> The example works because the file
>> 
>> looks like this:
>>
>>
>> {"created":"2016-08-10","organisationUnits":[{"id":"u6yjgvIMzKn",...
>>
>>
>> Hope this helps and best regards,
>>
>> Jason
>>
>>
>>
>>
>>
>> On Thu, Feb 15, 2018 at 6:34 AM, Isaiah Nyabuto 
>> wrote:
>>
>>>
>>> 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 steps,
>>> any help will be appreciated.
>>>
>>>
>>> head(org)  name uid   code  parent  
>>>shortname
>>> 1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7  Wikithuki 
>>> Dispensary
>>> 2Gemifa Medical Clinic Z7Lf1n3Fcpi  22907 mEZBjj4fLBT   
>>>  Gemifa
>>> 3   Olympus Medical Clinic NAbQdHuaJFK  22906 PeEcMfBchbr   
>>> Olympus
>>> 4 Masaba Community Health Unit tYwHeLSnHyb 600616 QR2K4k8VKF1
>>> Masaba CHU
>>> 5Gatunga Health Centre cmay4WXRmhA  12034 IcAegRcGuV6 Gatunga 
>>> Health Centre
>>> 6 Cfw Kimangaru Clinic E52UsoBxJVS  11966 vEAFtHnPDrX  CFW 
>>> Kimangaru Clinic
>>>  description openingdate closedate comment featuretype  
>>> coordinates url
>>> 1 NANA   POINT  
>>> [37.95263,-0.77819]
>>> 2 Clinic  NANANONE 
>>> [34.391914,0.059575]
>>> 3 Clinic  NANANONE   
>>> [34.3994,0.059575]
>>> 4 Community Unit  NANANONE   
>>> [34.46411,0.19358]
>>> 5 NANA   POINT   
>>> [37.9423,-0.29656]
>>> 6 NANA   POINT  
>>> [37.53009,-0.54506]
>>>   contactperson address email phonenumber
>>> 1NA  NANA  NA
>>> 2NA  NANA  NA
>>> 3NA  NANA  NA
>>> 4NA  NANA  NA
>>> 5NA  NANA  NA
>>> 6NA  NANA  NA
>>>
>>>
>>> I followed the following steps to prepare my df for import.
>>> 1. Removed all the NAs  and columns with entire NAs.
>>>
>>> head(new_org)  name uid   code  parent  
>>>shortname
>>> 1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7  Wikithuki 
>>> Dispensary
>>> 2Gemifa Medical Clinic Z7Lf1n3Fcpi  22907 mEZBjj4fLBT   
>>>  Gemifa
>>> 3   Olympus Medical Clinic NAbQdHuaJFK  22906 PeEcMfBchbr   
>>> Olympus
>>> 4 Masaba Community Health Unit tYwHeLSnHyb 600616 QR2K4k8VKF1
>>> Masaba CHU
>>> 5Gatunga Health Centre cmay4WXRmhA  12034 IcAegRcGuV6 Gatunga 
>>> Health Centre
>>> 6 Cfw Kimangaru Clinic E52UsoBxJVS  11966 vEAFtHnPDrX  CFW 
>>> Kimangaru Clinic
>>>  description comment featuretype  coordinates url
>>> 1  POINT  [37.95263,-0.77819]
>>> 2 ClinicNONE [34.391914,0.059575]
>>> 3 ClinicNONE   

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
org.hisp.dhis.organisationunit.OrganisationUnit] from String value
('It7fWcKbcZX'); no single-String constructor/factory method\\n at
[Source: org.apache.catalina.connector.CoyoteInputStream@1efec811;
line: 1, column: 73] (through reference chain:
org.hisp.dhis.organisationunit.OrganisationUnit[\\\"parent\\\"])\"}"


Thank you.

On Thu, Feb 15, 2018 at 10:36 AM, Jason Pickering <
jason.p.picker...@gmail.com> wrote:

> 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, dest.pass),
> body = toJSON(list(organisationUnits=new_org), auto_unbox =
> TRUE),
> content_type_json())
>
> should work.
>
> The example works because the file
> 
> looks like this:
>
>
> {"created":"2016-08-10","organisationUnits":[{"id":"u6yjgvIMzKn",...
>
>
> Hope this helps and best regards,
>
> Jason
>
>
>
>
>
> On Thu, Feb 15, 2018 at 6:34 AM, Isaiah Nyabuto 
> wrote:
>
>>
>> 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 steps,
>> any help will be appreciated.
>>
>>
>> head(org)  name uid   code  parent   
>>   shortname
>> 1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7  Wikithuki 
>> Dispensary
>> 2Gemifa Medical Clinic Z7Lf1n3Fcpi  22907 mEZBjj4fLBT
>> Gemifa
>> 3   Olympus Medical Clinic NAbQdHuaJFK  22906 PeEcMfBchbr   
>> Olympus
>> 4 Masaba Community Health Unit tYwHeLSnHyb 600616 QR2K4k8VKF1
>> Masaba CHU
>> 5Gatunga Health Centre cmay4WXRmhA  12034 IcAegRcGuV6 Gatunga Health 
>> Centre
>> 6 Cfw Kimangaru Clinic E52UsoBxJVS  11966 vEAFtHnPDrX  CFW Kimangaru 
>> Clinic
>>  description openingdate closedate comment featuretype  
>> coordinates url
>> 1 NANA   POINT  
>> [37.95263,-0.77819]
>> 2 Clinic  NANANONE 
>> [34.391914,0.059575]
>> 3 Clinic  NANANONE   
>> [34.3994,0.059575]
>> 4 Community Unit  NANANONE   
>> [34.46411,0.19358]
>> 5 NANA   POINT   
>> [37.9423,-0.29656]
>> 6 NANA   POINT  
>> [37.53009,-0.54506]
>>   contactperson address email phonenumber
>> 1NA  NANA  NA
>> 2NA  NANA  NA
>> 3NA  NANA  NA
>> 4NA  NANA  NA
>> 5NA  NANA  NA
>> 6NA  NANA  NA
>>
>>
>> I followed the following steps to prepare my df for import.
>> 1. Removed all the NAs  and columns with entire NAs.
>>
>> head(new_org)  name uid   code  parent   
>>   shortname
>> 1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7  Wikithuki 
>> Dispensary
>> 2Gemifa Medical Clinic Z7Lf1n3Fcpi  22907 mEZBjj4fLBT
>> Gemifa
>> 3   Olympus Medical Clinic NAbQdHuaJFK  22906 PeEcMfBchbr   
>> Olympus
>> 4 Masaba Community Health Unit tYwHeLSnHyb 600616 QR2K4k8VKF1
>> Masaba CHU
>> 5Gatunga Health Centre cmay4WXRmhA  12034 IcAegRcGuV6 Gatunga Health 
>> Centre
>> 6 Cfw Kimangaru Clinic E52UsoBxJVS  11966 vEAFtHnPDrX  CFW Kimangaru 
>> Clinic
>>  description comment featuretype  coordinates url
>> 1  POINT  [37.95263,-0.77819]
>> 2 ClinicNONE [34.391914,0.059575]
>> 3 ClinicNONE   [34.3994,0.059575]
>> 4 Community UnitNONE   [34.46411,0.19358]
>> 5  POINT   [37.9423,-0.29656]
>> 6  POINT  [37.53009,-0.54506]
>>
>>
>> 3. Then post the data as follows.
>>
>> dest.url <- "http://localhost/dhis/;
>> url <- paste0(dest.url, "api/metadata?importStrategy=C
>> REATE=NONE")
>>   r <- POST(url, authenticate(dest.user, dest.pass),
>> body = toJSON(new_org, auto_unbox = TRUE),
>> content_type_json())
>>   

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, dest.pass),
body = toJSON(list(organisationUnits=new_org), auto_unbox =
TRUE),
content_type_json())

should work.

The example works because the file

looks like this:


{"created":"2016-08-10","organisationUnits":[{"id":"u6yjgvIMzKn",...


Hope this helps and best regards,

Jason





On Thu, Feb 15, 2018 at 6:34 AM, Isaiah Nyabuto 
wrote:

>
> 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 steps,
> any help will be appreciated.
>
>
> head(org)  name uid   code  parent
>  shortname
> 1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7  Wikithuki 
> Dispensary
> 2Gemifa Medical Clinic Z7Lf1n3Fcpi  22907 mEZBjj4fLBT
> Gemifa
> 3   Olympus Medical Clinic NAbQdHuaJFK  22906 PeEcMfBchbr   
> Olympus
> 4 Masaba Community Health Unit tYwHeLSnHyb 600616 QR2K4k8VKF1
> Masaba CHU
> 5Gatunga Health Centre cmay4WXRmhA  12034 IcAegRcGuV6 Gatunga Health 
> Centre
> 6 Cfw Kimangaru Clinic E52UsoBxJVS  11966 vEAFtHnPDrX  CFW Kimangaru 
> Clinic
>  description openingdate closedate comment featuretype  
> coordinates url
> 1 NANA   POINT  
> [37.95263,-0.77819]
> 2 Clinic  NANANONE 
> [34.391914,0.059575]
> 3 Clinic  NANANONE   
> [34.3994,0.059575]
> 4 Community Unit  NANANONE   
> [34.46411,0.19358]
> 5 NANA   POINT   
> [37.9423,-0.29656]
> 6 NANA   POINT  
> [37.53009,-0.54506]
>   contactperson address email phonenumber
> 1NA  NANA  NA
> 2NA  NANA  NA
> 3NA  NANA  NA
> 4NA  NANA  NA
> 5NA  NANA  NA
> 6NA  NANA  NA
>
>
> I followed the following steps to prepare my df for import.
> 1. Removed all the NAs  and columns with entire NAs.
>
> head(new_org)  name uid   code  parent
>  shortname
> 1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7  Wikithuki 
> Dispensary
> 2Gemifa Medical Clinic Z7Lf1n3Fcpi  22907 mEZBjj4fLBT
> Gemifa
> 3   Olympus Medical Clinic NAbQdHuaJFK  22906 PeEcMfBchbr   
> Olympus
> 4 Masaba Community Health Unit tYwHeLSnHyb 600616 QR2K4k8VKF1
> Masaba CHU
> 5Gatunga Health Centre cmay4WXRmhA  12034 IcAegRcGuV6 Gatunga Health 
> Centre
> 6 Cfw Kimangaru Clinic E52UsoBxJVS  11966 vEAFtHnPDrX  CFW Kimangaru 
> Clinic
>  description comment featuretype  coordinates url
> 1  POINT  [37.95263,-0.77819]
> 2 ClinicNONE [34.391914,0.059575]
> 3 ClinicNONE   [34.3994,0.059575]
> 4 Community UnitNONE   [34.46411,0.19358]
> 5  POINT   [37.9423,-0.29656]
> 6  POINT  [37.53009,-0.54506]
>
>
> 3. Then post the data as follows.
>
> dest.url <- "http://localhost/dhis/;
> url <- paste0(dest.url, "api/metadata?importStrategy=C
> REATE=NONE")
>   r <- POST(url, authenticate(dest.user, dest.pass),
> body = toJSON(new_org, auto_unbox = TRUE),
> content_type_json())
>   assertthat::assert_that(r$status_code==200)
>
> 4. The body looks like.
>
> jsonlite::toJSON(me, auto_unbox = TRUE)[{"name":"Wikithuki 
> Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
>  
> Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
>  Medical 
> Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
>  Medical 
> Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
>  Community Health 
> 

[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 steps, any
help will be appreciated.


head(org)  name uid   code  parent
shortname
1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7
Wikithuki Dispensary
2Gemifa Medical Clinic Z7Lf1n3Fcpi  22907 mEZBjj4fLBT
  Gemifa
3   Olympus Medical Clinic NAbQdHuaJFK  22906 PeEcMfBchbr
 Olympus
4 Masaba Community Health Unit tYwHeLSnHyb 600616 QR2K4k8VKF1
  Masaba CHU
5Gatunga Health Centre cmay4WXRmhA  12034 IcAegRcGuV6 Gatunga
Health Centre
6 Cfw Kimangaru Clinic E52UsoBxJVS  11966 vEAFtHnPDrX  CFW
Kimangaru Clinic
 description openingdate closedate comment featuretype
coordinates url
1 NANA   POINT
[37.95263,-0.77819]
2 Clinic  NANANONE
[34.391914,0.059575]
3 Clinic  NANANONE
[34.3994,0.059575]
4 Community Unit  NANANONE
[34.46411,0.19358]
5 NANA   POINT
[37.9423,-0.29656]
6 NANA   POINT
[37.53009,-0.54506]
  contactperson address email phonenumber
1NA  NANA  NA
2NA  NANA  NA
3NA  NANA  NA
4NA  NANA  NA
5NA  NANA  NA
6NA  NANA  NA


I followed the following steps to prepare my df for import.
1. Removed all the NAs  and columns with entire NAs.

head(new_org)  name uid   code
parent shortname
1 Wikithuki Dispensary Bc371uxfYD5  16925 vpiZlB5cdK7
Wikithuki Dispensary
2Gemifa Medical Clinic Z7Lf1n3Fcpi  22907 mEZBjj4fLBT
  Gemifa
3   Olympus Medical Clinic NAbQdHuaJFK  22906 PeEcMfBchbr
 Olympus
4 Masaba Community Health Unit tYwHeLSnHyb 600616 QR2K4k8VKF1
  Masaba CHU
5Gatunga Health Centre cmay4WXRmhA  12034 IcAegRcGuV6 Gatunga
Health Centre
6 Cfw Kimangaru Clinic E52UsoBxJVS  11966 vEAFtHnPDrX  CFW
Kimangaru Clinic
 description comment featuretype  coordinates url
1  POINT  [37.95263,-0.77819]
2 ClinicNONE [34.391914,0.059575]
3 ClinicNONE   [34.3994,0.059575]
4 Community UnitNONE   [34.46411,0.19358]
5  POINT   [37.9423,-0.29656]
6  POINT  [37.53009,-0.54506]


3. Then post the data as follows.

dest.url <- "http://localhost/dhis/;
url <- paste0(dest.url, "api/metadata?importStrategy=C
REATE=NONE")
  r <- POST(url, authenticate(dest.user, dest.pass),
body = toJSON(new_org, auto_unbox = TRUE),
content_type_json())
  assertthat::assert_that(r$status_code==200)

4. The body looks like.

jsonlite::toJSON(me, auto_unbox = TRUE)[{"name":"Wikithuki
Dispensary","uid":"Bc371uxfYD5","code":"16925","parent":"vpiZlB5cdK7","shortname":"Wikithuki
Dispensary","description":"","comment":"","featuretype":"POINT","coordinates":"[37.95263,-0.77819]","url":""},{"name":"Gemifa
Medical 
Clinic","uid":"Z7Lf1n3Fcpi","code":"22907","parent":"mEZBjj4fLBT","shortname":"Gemifa","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.391914,0.059575]","url":""},{"name":"Olympus
Medical 
Clinic","uid":"NAbQdHuaJFK","code":"22906","parent":"PeEcMfBchbr","shortname":"Olympus","description":"Clinic","comment":"","featuretype":"NONE","coordinates":"[34.3994,0.059575]","url":""},{"name":"Masaba
Community Health
Unit","uid":"tYwHeLSnHyb","code":"600616","parent":"QR2K4k8VKF1","shortname":"Masaba
CHU","description":"Community
Unit","comment":"","featuretype":"NONE","coordinates":"[34.46411,0.19358]","url":""},{"name":"Gatunga
Health 
Centre","uid":"cmay4WXRmhA","code":"12034","parent":"IcAegRcGuV6","shortname":"Gatunga
Health 
Centre","description":"","comment":"","featuretype":"POINT","coordinates":"[37.9423,-0.29656]","url":""},{"name":"Cfw
Kimangaru 
Clinic","uid":"E52UsoBxJVS","code":"11966","parent":"vEAFtHnPDrX","shortname":"CFW
Kimangaru 
Clinic","description":"","comment":"","featuretype":"POINT","coordinates":"[37.53009,-0.54506]","url":""}]


What could be the problem there? I get status 200 and still it doesn't
import.


Thank you


-- 

Isaiah Nyabuto
+254 729 572 616
Bsc. Health Records Management & Informatics, JKUAT.
___
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe :