dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #01622
Re: New Organization Units Import
Hi,
Writing is not supported for /api/organisationUnits (sorry, that might not
have been clear). Try and push the XML to /api/metaData
--
Morten
On Wed, Dec 12, 2012 at 11:25 AM, ChangJames <jamesbjchang@xxxxxxxxxxx>wrote:
> Thank you all for the help. They were quite helpful.
>
> I have tried both database method and cURL Meta-data import.
> The database method was successful, using ‘nextval('hibernate_sequence')’
> and restart of DHIS2 for UID auto populate.
>
> However, I am still struggling with cURL method.
> I have downloaded curl.exe and ran it (in Windows 7).
> I keep on getting ‘HTTP Status 405 – Request method ‘POST’ not supported’
> error.
> Is there something I have to set on DHIS2 or on server for this?
>
> The command I used is –> curl –d @test3.xml “http://107.—.—.—:8080/dhis/api/organizationUnits”;
> –H “Content-Type:application/xml” –u ---/--- -v
> This is for adding a new OrganizationUnit. In this email, I have attached
> curl error output and test Meta-data xml files.
> I have tried variations of the curl commands (removing header parameters,
> etc) and variations of Meta-data xml file contents(adding/removing UID, ID,
> etc), but all gave me 405 error.
>
> If it is not about the DHIS2 setup issue, I was wondering if someone can
> provide me with any success case curl command and Meta-data xml file, so
> that I can use that was an example to follow.
>
> Thank you in advance for any help.
>
>
>
> *From:* Morten Olav Hansen <mortenoh@xxxxxxxxx>
> *Sent:* Wednesday, December 05, 2012 10:25 PM
> *To:* ChangJames <jamesbjchang@xxxxxxxxxxx>
> *Cc:* dhis2-users <dhis2-users@xxxxxxxxxxxxxxxxxxx>
> *Subject:* Re: [Dhis2-users] New Organization Units Import
>
> That should be "without any ou-levels"
>
> --
> Morten
>
>
> On Wed, Dec 5, 2012 at 4:24 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>wrote:
>
>> Do you have a structure in the data your are importing, or is it a flat
>> list with any ou-levels? I would personally use the DHIS 2 web-api to
>> import the data.
>>
>> For examples, look at our documentation for meta-data import:
>> http://dhis2.org/doc/snapshot/en/user/html/ch23s04.html
>>
>> So you would use something like:
>> <metaData>
>> <organisationUnits>
>> <organisationUnit> .... </organisationUnit>
>> <organisationUnit> .... </organisationUnit>
>> <organisationUnit> .... </organisationUnit>
>> <organisationUnit> .... </organisationUnit>
>> </organisationUnits>
>> </metaData>
>>
>> For examples of the meta-data, have a look at:
>> http://apps.dhis2.org/demo/api
>> http://apps.dhis2.org/demo/api/metaData.xml
>>
>> This can then be pushed into DHIS using your username/password, and a
>> proper content-type (I would personally use cURL for this)
>>
>> --
>> Morten
>>
>>
>> On Wed, Dec 5, 2012 at 4:20 PM, ChangJames <jamesbjchang@xxxxxxxxxxx>wrote:
>>
>>> Hi,
>>>
>>> Is there any easy way(/preferred way) to import Organization Units (New
>>> ones) on blank DHIS2 system?
>>> I have a list of organization units I like to add to the system, but
>>> like to know if there is an alternative to the individual manual add using
>>> DHIS UI.
>>>
>>> It seems there isn’t import function for this on DHIS, so I took a look
>>> at datatable for inserting straight to DB.
>>> But, the ‘OrganizationUnit’ table has ‘UID’ field. How do I generate
>>> that? One of my data ‘jII07NoHiO5’ does seem like normal Uniquie
>>> Identifier number format.
>>> And is this, adding rows straight to datatable, a OK way of mass
>>> importing the Organization Units on DHIS?
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-users
>>> Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>> More help : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>
>
Follow ups
References