← Back to team overview

dhis2-users team mailing list archive

Re: Assign dataSets by using the Web API

 

Hi,

Can you provide the full stack trace?

--
Morten

On Tue, Nov 4, 2014 at 5:16 PM, Octavio GLORIO <
Octavio.GLORIO@xxxxxxxxxxxxxxxxx> wrote:

> Hi all there,
> I am facing a problem while trying to create an orgUnit and assign a
> dataSet.
> Specifically, I have tried two options:
>
>    - Assign the dataSet while creating the orgUnit, here some sample
>    json:
>
> * {"organisationUnits":[{"name":"Hospitalization
> Ward112","shortName":"Hospitalization
> Ward112","level":7,"parent":{"id":"Qa2YaAbgBdd"},"dataSets":[{"id":"uceRzlqmJeg"}]}]}*
> ... the orgUnit is created but nor dataSet assigned
>
>    - Assign the orgUnit to the dataSet, here some sample json:
>
>
> *{"dataSets":[{"id":"uceRzlqmJeg","organisationUnits":[{"id":"bJgURXB4miQ"}]}]}*
> ... the original dataset is overwrite and dataElemts and previous assigned
> orgUnits are losed.
>
> Then, I realized  the posibility of "Adding and removing objects to/from
> collections" using this syntax :
> */api/{collection-object}/{collection-object-id}/{collection-name}/{object-id}*.
> Therefore, I tried :
>
>    - *http://localhost:8080/dhis216/api/dataSets/uceRzlqmJeg/organisationUnits/Bj9hub0yvwo
>    <http://localhost:8080/dhis216/api/dataSets/uceRzlqmJeg/organisationUnits/Bj9hub0yvwo>*
>    - *http://localhost:8080/dhis216/api/organisationUnits/Bj9hub0yvwo/dataSets/uceRzlqmJeg
>    <http://localhost:8080/dhis216/api/organisationUnits/Bj9hub0yvwo/dataSets/uceRzlqmJeg>*
>
> ... but nor of them work. The error do ot said to much to me, maybe for
> one of you it gives you some insights. Here you have:
> *Nov 04, 2014 11:03:06 AM org.apache.catalina.core.StandardWrapperValve
> invoke*
> *SEVERE: Servlet.service() for servlet [webapi] in context with path
> [/dhis216] threw exception [Request processing failed; nested exception is
> java.lang.NullPointerException] with root cause*
>
> I am sure, that one of these options has to work but I can not figure out
> my pitfall. Any help is welcome.
> Thanks in advance.
> Regards,
> Octavio.
>
>
> _______________________________________________
> 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