dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #45148
Re: Problem creating the parent org unit through the API
Hi Sergio
You have a couple of options, you can switch to using "code", which can
basically be anything.
Another option is to simply generate the parent UIDs beforehand using
/api/system/id?limit=X
http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s39.html#d0e9612
--
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org
On Wed, May 25, 2016 at 6:54 PM, Sergio Valenzuela <
sergio.valenzuela@xxxxxxxx> wrote:
> Thanks Morten, yes, we were trying to create a new root and we were
> missing that step.
>
> My question now is: In the "parent" object included in
> "organisationUnits", is it possible to swap the attribute "id" to "name"
> (or something you know when you are creating the parents)? Otherwise, how
> can be done the import of a whole org unit hierarchy (in a single json)
> when you don't know the "id" of the "parents"?
>
> I attached an image pointing the part of the json I'm talking about.
>
>
>
> *Sergio Valenzuela*
> Fundación EHAS
> Telemedicina para países en desarrollo -* www.ehas.org
> <http://www.ehas.org/>*
> E.T.S.I. de Telecomunicación A.101-9L. Ciudad Universitaria 30, 28040
> Madrid - España
> Tlfno. (+34) 91 488 87 41: (+34) 687 67 17 62
>
>
>
> 2016-05-25 13:13 GMT+02:00 Morten Olav Hansen <morten@xxxxxxxxx>:
>
>> Hi Sergio
>>
>> So you are creating a new root? Could it be that your user is attached to
>> a different org unit, and so the problem is that you can't see them?
>>
>> Maybe you could verify in the database, or using the web-api?
>> /api/organisationUnits.json?filter=name:like:abc
>>
>> --
>> Morten Olav Hansen
>> Senior Engineer, DHIS 2
>> University of Oslo
>> http://www.dhis2.org
>>
>> On Wed, May 25, 2016 at 6:06 PM, Sergio Valenzuela <
>> sergio.valenzuela@xxxxxxxx> wrote:
>>
>>> Hello devs,
>>>
>>> We are trying to create a whole org unit hierarchy through the new API
>>> resource /api/23/metadata .
>>> During the process, we realized there should be some kind of problem
>>> when we tried to create the parent org unit (the parent of the whole
>>> hierarchy), because even If the answer from the server is 200 OK once we
>>> sent the POST and with a GET we can verify that the org units are created
>>> successfully, no org units are appearing on Maintenance App. We are using
>>> the same version and build as in demo server (version 2.23 and build
>>> 22969).
>>> We tried the same in demo server with the same result.
>>>
>>> I attached our JSON and the url we were doing the POST request:
>>>
>>> - https://play.dhis2.org/demo/api/23/metadata
>>> <https://www.google.com/url?q=https%3A%2F%2Fplay.dhis2.org%2Fdemo%2Fapi%2F23%2Fmetadata&sa=D&sntz=1&usg=AFQjCNFEcEvpUIBy7DQX7KNTUvGRw7nObw>
>>>
>>> Besides, we tried to create the parent org unit of the whole hierarchy
>>> through the Maintenance interface with the same result. Apparently, it is
>>> created but not shown after on Maintenance App. (We made a GET to
>>> http://localhost:8080/api/metadata?assumeTrue=false&organisationUnits=true
>>> and we verified that the org unit was created)
>>>
>>> Tell me If I'm doing something wrong here or If this issue was already
>>> reported.
>>>
>>> Best Regards!
>>>
>>> *Sergio Valenzuela*
>>> Fundación EHAS
>>> Telemedicina para países en desarrollo -* www.ehas.org
>>> <http://www.ehas.org/>*
>>> E.T.S.I. de Telecomunicación A.101-9L. Ciudad Universitaria 30, 28040
>>> Madrid - España
>>> Tlfno. (+34) 91 488 87 41: (+34) 687 67 17 62
>>>
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>
References