← Back to team overview

dhis2-users team mailing list archive

Re: Web API to get options for a specific optionSet

 

Dear Knut,

I actually read the chapter you linked me, but I couldn't figure out
how to know (referring to your example) that the new option's ID was
UVBgmarFGFb

Anyway thank you very much for your support!

iuri

2016-04-16 22:34 GMT+02:00 Knut Staring <knutst@xxxxxxxxx>:
> You can first add a new option by creating a simple file like this, which I
> called 100years.json:
>
> {
> "name": "Over 100"
> }
>
> Then add it:
> curl -d @100years.json "https://play.dhis2.org/demo/api/options"; -X POST -H
> "Content-Type: application/json" -u admin:district
>
> Then add the new option to the optionSet:
> curl
> "https://play.dhis2.org/demo/api/optionSets/VQ2lai3OfVG/options/UVBgmarFGFb";
> -X POST -H "Content-Type: application/json" -u admin:district
>
> Finally, inspect the optionSet. It should now have 5 members instead of 4:
> https://play.dhis2.org/demo/api/optionSets/VQ2lai3OfVG.json?fields=name,options[:all]
>
>
>
> On Sat, Apr 16, 2016 at 9:51 PM, Knut Staring <knutst@xxxxxxxxx> wrote:
>>
>> Hi Luri,
>>
>> Please see section 1.10.4. Adding and removing objects to/from collections
>> here:
>>
>> http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s10.html
>>
>> Knut
>>
>> On Sat, Apr 16, 2016 at 2:37 AM, Iuri Fanti <iuri.fanti@xxxxxxxxx> wrote:
>>>
>>> And what if I needed to put/create a specific option into a specific
>>> optionSet?
>>>
>>> 2016-04-15 19:46 GMT+02:00 Iuri Fanti <iuri.fanti@xxxxxxxxx>:
>>> > Great Knut, it's exactly what I needed! :)
>>> >
>>> > Thank you so much!
>>> >
>>> > Iuri
>>> >
>>> > 2016-04-15 19:28 GMT+02:00 Knut Staring <knutst@xxxxxxxxx>:
>>> >> Something along these lines?
>>> >>
>>> >>
>>> >> https://play.dhis2.org/demo/api/optionSets/VQ2lai3OfVG.json?fields=name,options[:all]
>>> >>
>>> >> On Fri, Apr 15, 2016 at 7:15 PM, Iuri Fanti <iuri.fanti@xxxxxxxxx>
>>> >> wrote:
>>> >>>
>>> >>> Hi all,
>>> >>>
>>> >>> is there a Web API call to get the option values for a specific
>>> >>> optionSet? I have a lot of option values, and it's not reasonable to
>>> >>> download all of them. I need to filter by the parent optionSet,
>>> >>> somehow. Is it possibile?
>>> >>>
>>> >>> Thanks,
>>> >>>
>>> >>> Iuri
>>> >>>
>>> >>> --
>>> >>> @-`-,--
>>> >>>
>>> >>> _______________________________________________
>>> >>> 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
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> Knut Staring
>>> >> Dept. of Informatics, University of Oslo
>>> >> Norway: +4791880522
>>> >> Skype: knutstar
>>> >> http://dhis2.org
>>> >
>>> >
>>> >
>>> > --
>>> > @-`-,--
>>>
>>>
>>>
>>> --
>>> @-`-,--
>>>
>>> _______________________________________________
>>> 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
>>
>>
>>
>>
>> --
>> Knut Staring
>> Dept. of Informatics, University of Oslo
>> Norway: +4791880522
>> Skype: knutstar
>> http://dhis2.org
>
>
>
>
> --
> Knut Staring
> Dept. of Informatics, University of Oslo
> Norway: +4791880522
> Skype: knutstar
> http://dhis2.org



-- 
@-`-,--


Follow ups

References