Web API to get options for a specific optionSet

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

···

--
@-`-,--

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@gmail.com 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@lists.launchpad.net

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

Great Knut, it's exactly what I needed! :slight_smile:

Thank you so much!

Iuri

···

2016-04-15 19:28 GMT+02:00 Knut Staring <knutst@gmail.com>:

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@gmail.com> 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@lists.launchpad.net
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

--
@-`-,--

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

Great Knut, it's exactly what I needed! :slight_smile:

Thank you so much!

Iuri

2016-04-15 19:28 GMT+02:00 Knut Staring <knutst@gmail.com>:

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@gmail.com> 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@lists.launchpad.net
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

--
@-`-,--

--
@-`-,--

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

Great Knut, it’s exactly what I needed! :slight_smile:

Thank you so much!

Iuri

2016-04-15 19:28 GMT+02:00 Knut Staring knutst@gmail.com:

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@gmail.com 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@lists.launchpad.net

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@lists.launchpad.net

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

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.jsonhttps://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@gmail.com 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@gmail.com 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@gmail.com:

Great Knut, it’s exactly what I needed! :slight_smile:

Thank you so much!

Iuri

2016-04-15 19:28 GMT+02:00 Knut Staring knutst@gmail.com:

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@gmail.com 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@lists.launchpad.net

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@lists.launchpad.net

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

Dear all

I am one of the DHIS2 user I need to

Using the DHIS2 source code and API develop an Android app with the following features:

· A standalone application for collecting data and analyzing data of one single health facility.

· Be connected to DHIS2 backend.

· Forms and user interfaces for data collection and data entry.

· Support offline data entry.

· Store data locally when there is no network connection to the server and synchronize with the Server when connected.

· Provide instant reports off of the data entered offline.

· Provide a dashboard that provides real time reports from DHIS2 server.

· Provide analytic reporting of the data for the health facility.

The app is bound to a single facility. Its data is sent out to a centralized DHIS2 Server where all the data across facilities are stored. Reporting and analytics of all facilities are done on the centralized DHIS2 database.

Pleas assesse me in this regards

Thanks

Azimi

···

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.jsonhttps://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@gmail.com 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@gmail.com 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@gmail.com:

Great Knut, it’s exactly what I needed! :slight_smile:

Thank you so much!

Iuri

2016-04-15 19:28 GMT+02:00 Knut Staring knutst@gmail.com:

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@gmail.com 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@lists.launchpad.net

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@lists.launchpad.net

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

Dear all

I am one of the DHIS2 user I need to

Using the DHIS2 source code and API develop an Android app with the following features:

· A standalone application for collecting data and analyzing data of one single health facility.

· Be connected to DHIS2 backend.

· Forms and user interfaces for data collection and data entry.

· Support offline data entry.

· Store data locally when there is no network connection to the server and synchronize with the Server when connected.

· Provide instant reports off of the data entered offline.

· Provide a dashboard that provides real time reports from DHIS2 server.

· Provide analytic reporting of the data for the health facility.

The app is bound to a single facility. Its data is sent out to a centralized DHIS2 Server where all the data across facilities are stored. Reporting and analytics of all facilities are done on the centralized DHIS2 database.

Pleas assesse me in this regards

Thanks

Azimi

From:
Dhis2-users [mailto:dhis2-users-bounces+mahmood.azimi=jhpiego.org@lists.launchpad.net] On Behalf Of Knut Staring

···

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.jsonhttps://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@gmail.com 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@gmail.com 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@gmail.com:

Great Knut, it’s exactly what I needed! :slight_smile:

Thank you so much!

Iuri

2016-04-15 19:28 GMT+02:00 Knut Staring knutst@gmail.com:

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@gmail.com 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@lists.launchpad.net

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@lists.launchpad.net

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

Thank you dear

For your kind information actually I need to have A standalone android application for collecting data and analyzing data of one single health facility in tablet that be connected to DHIS2 backend and that will be able to analyzed the data and showing the data as a dashboard within the tablet offline.

Thanks

Azimi .

···

From: Araz Abishov [mailto:araz@dhis2.org]

Sent: Monday, April 18, 2016 11:04 AM

To: Mahmood Azimi Mahmood.Azimi@jhpiego.org; Iuri Fanti iuri.fanti@gmail.com; Knut Staring knutst@gmail.com

Cc: dhis1-users dhis2-users@lists.launchpad.net

Subject: Re: [Dhis2-users] Web API to get options for a specific optionSet

Hi Azimi,

Before starting implementing your own solution, I highly advise you to take a look into existing DHIS2 android apps:

Data capture (for capturing routine data):

Play: https://play.google.com/store/apps/details?id=org.dhis2.mobile

GitHub: https://github.com/dhis2/dhis2-android-datacapture/tree/legacy

Event capture (for capturing single events):

Play: https://play.google.com/store/apps/details?id=org.hisp.dhis.android.eventcapture

GitHub: https://github.com/dhis2/dhis2-android-eventcapture/tree/2.22-legacy

Tracker capture:

Play: https://play.google.com/store/apps/details?id=org.hisp.dhis.android.trackercapture

GitHub: https://github.com/dhis2/dhis2-android-trackercapture/tree/2.22-legacy

Dashboard:

Play: https://play.google.com/store/apps/details?id=org.hisp.dhis.android.dashboard

GitHub: https://github.com/dhis2/dhis2-android-dashboard/tree/legacy

We are also working on android SDK for DHIS2 (currently it is not released, but stay tuned for updates):

https://github.com/dhis2/dhis2-android-sdk

But if those apps do not fulfill your requirements, you can also take a look into DHIS2 Web API documentation:

http://dhis2.github.io/dhis2-docs/2.22/en/developer/html/dhis2_developer_manual_full.html

Best Regards,

Araz Abishov,

Android developer, DHIS 2

University of Oslo

https://www.dhis2.org/

On April 18, 2016 at 6:51:47 AM, Mahmood Azimi (mahmood.azimi@jhpiego.org) wrote:

Dear all

I am one of the DHIS2 user I need to

Using the DHIS2 source code and API develop an Android app with the following features:

· A standalone application for collecting data and analyzing data of one single health facility.

· Be connected to DHIS2 backend.

· Forms and user interfaces for data collection and data entry.

· Support offline data entry.

· Store data locally when there is no network connection to the server and synchronize with the Server when connected.

· Provide instant reports off of the data entered offline.

· Provide a dashboard that provides real time reports from DHIS2 server.

· Provide analytic reporting of the data for the health facility.

The app is bound to a single facility. Its data is sent out to a centralized DHIS2 Server where all the data across facilities are stored. Reporting and analytics of all facilities are done on the centralized DHIS2 database.

Pleas assesse me in this regards

Thanks

Azimi

From:
Dhis2-users [mailto:dhis2-users-bounces+mahmood.azimi=jhpiego.org@lists.launchpad.net] On Behalf Of Knut Staring

Sent: Sunday, April 17, 2016 1:05 AM

To: Iuri Fanti iuri.fanti@gmail.com

Cc: dhis1-users dhis2-users@lists.launchpad.net

Subject: Re: [Dhis2-users] Web API to get options for a specific optionSet

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.jsonhttps://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@gmail.com 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@gmail.com 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@gmail.com:

Great Knut, it’s exactly what I needed! :slight_smile:

Thank you so much!

Iuri

2016-04-15 19:28 GMT+02:00 Knut Staring knutst@gmail.com:

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@gmail.com 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@lists.launchpad.net

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@lists.launchpad.net

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


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Hi guys,

just a kind reminder that please create a new thread when you want to discuss another topic, don’t reply to a different question.

Our user / implementation list is:

dhis2-users@lists.launchpad.net

Our dev / web-api / scripting list is:

dhis2-devs@lists.launchpad.net

···

On Mon, Apr 18, 2016 at 3:44 PM, Mahmood Azimi Mahmood.Azimi@jhpiego.org wrote:

Thank you dear

For your kind information actually I need to have A standalone android application for collecting data and analyzing data of one single health facility in tablet that be connected to DHIS2 backend and that will be able to analyzed the data and showing the data as a dashboard within the tablet offline.

Thanks

Azimi .

From: Araz Abishov [mailto:araz@dhis2.org]

Sent: Monday, April 18, 2016 11:04 AM

To: Mahmood Azimi Mahmood.Azimi@jhpiego.org; Iuri Fanti iuri.fanti@gmail.com; Knut Staring knutst@gmail.com

Cc: dhis1-users dhis2-users@lists.launchpad.net

Subject: Re: [Dhis2-users] Web API to get options for a specific optionSet

Hi Azimi,

Before starting implementing your own solution, I highly advise you to take a look into existing DHIS2 android apps:

Data capture (for capturing routine data):

Play: https://play.google.com/store/apps/details?id=org.dhis2.mobile

GitHub: https://github.com/dhis2/dhis2-android-datacapture/tree/legacy

Event capture (for capturing single events):

Play: https://play.google.com/store/apps/details?id=org.hisp.dhis.android.eventcapture

GitHub: https://github.com/dhis2/dhis2-android-eventcapture/tree/2.22-legacy

Tracker capture:

Play: https://play.google.com/store/apps/details?id=org.hisp.dhis.android.trackercapture

GitHub: https://github.com/dhis2/dhis2-android-trackercapture/tree/2.22-legacy

Dashboard:

Play: https://play.google.com/store/apps/details?id=org.hisp.dhis.android.dashboard

GitHub: https://github.com/dhis2/dhis2-android-dashboard/tree/legacy

We are also working on android SDK for DHIS2 (currently it is not released, but stay tuned for updates):

https://github.com/dhis2/dhis2-android-sdk

But if those apps do not fulfill your requirements, you can also take a look into DHIS2 Web API documentation:

http://dhis2.github.io/dhis2-docs/2.22/en/developer/html/dhis2_developer_manual_full.html

Best Regards,

Araz Abishov,

Android developer, DHIS 2

University of Oslo

https://www.dhis2.org/

On April 18, 2016 at 6:51:47 AM, Mahmood Azimi (mahmood.azimi@jhpiego.org) wrote:

Dear all

I am one of the DHIS2 user I need to

Using the DHIS2 source code and API develop an Android app with the following features:

· A standalone application for collecting data and analyzing data of one single health facility.

· Be connected to DHIS2 backend.

· Forms and user interfaces for data collection and data entry.

· Support offline data entry.

· Store data locally when there is no network connection to the server and synchronize with the Server when connected.

· Provide instant reports off of the data entered offline.

· Provide a dashboard that provides real time reports from DHIS2 server.

· Provide analytic reporting of the data for the health facility.

The app is bound to a single facility. Its data is sent out to a centralized DHIS2 Server where all the data across facilities are stored. Reporting and analytics of all facilities are done on the centralized DHIS2 database.

Pleas assesse me in this regards

Thanks

Azimi

From:
Dhis2-users [mailto:dhis2-users-bounces+mahmood.azimi=jhpiego.org@lists.launchpad.net] On Behalf Of Knut Staring

Sent: Sunday, April 17, 2016 1:05 AM

To: Iuri Fanti iuri.fanti@gmail.com

Cc: dhis1-users dhis2-users@lists.launchpad.net

Subject: Re: [Dhis2-users] Web API to get options for a specific optionSet

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.jsonhttps://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@gmail.com 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@gmail.com 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@gmail.com:

Great Knut, it’s exactly what I needed! :slight_smile:

Thank you so much!

Iuri

2016-04-15 19:28 GMT+02:00 Knut Staring knutst@gmail.com:

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@gmail.com 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@lists.launchpad.net

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@lists.launchpad.net

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


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

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

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@gmail.com> 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@gmail.com> 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@gmail.com>:
> Great Knut, it's exactly what I needed! :slight_smile:
>
> Thank you so much!
>
> Iuri
>
> 2016-04-15 19:28 GMT+02:00 Knut Staring <knutst@gmail.com>:
>> 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@gmail.com> >>> >> 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@lists.launchpad.net
>>> 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@lists.launchpad.net
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

--
@-`-,--

Hi Luri

Probably the best approach to creating new options (and adding to a optionset) is:

  1. Create UIDs for every option (/api/system/id?limit=100)

  2. Create all your options { “id”: “generated-uid”, “name”: “option-name”, “code”: “option-code” }

  3. Add or create your option set { “id”: “existing-uid, generated-uid, or null to let the system create”, “name”: “optionset-name”, “valueType”: “wanted value type”, “options”: [your options]

  4. Wrap this in the correct payload (see below) and send to /api/metadata with correct content-type (application/json)

{

“options”: [

{ “id”: “id1”, “name”: “Male”, “code”: “M” },

{ “id”: “id2”, “name”: “Female”, “code”: “F” }

],

“optionSets”: [

{

“id”: “id if you have it”,

“name”: “optionset-name”,

“valueType”: “optionset-value-type”,

“options”: [{“id”:“id1”},{“id”:“id2”}]

}

]

}

···

On Tue, Apr 19, 2016 at 8:56 AM, Iuri Fanti iuri.fanti@gmail.com wrote:

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

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.jsonhttps://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@gmail.com 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@gmail.com 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@gmail.com:

Great Knut, it’s exactly what I needed! :slight_smile:

Thank you so much!

Iuri

2016-04-15 19:28 GMT+02:00 Knut Staring knutst@gmail.com:

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

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@lists.launchpad.net

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@lists.launchpad.net

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

@-`-,–


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

Wouldn't it be much simpler if the server gave back the id of the
newly created option as a response?

···

2016-04-19 7:10 GMT+02:00 Morten Olav Hansen <morten@dhis2.org>:

Hi Luri

Probably the best approach to creating new options (and adding to a
optionset) is:

1. Create UIDs for every option (/api/system/id?limit=100)
2. Create all your options { "id": "generated-uid", "name": "option-name",
"code": "option-code" }
3. Add or create your option set { "id": "existing-uid, generated-uid, or
null to let the system create", "name": "optionset-name", "valueType":
"wanted value type", "options": [your options]
4. Wrap this in the correct payload (see below) and send to /api/metadata
with correct content-type (application/json)

{
  "options": [
    { "id": "id1", "name": "Male", "code": "M" },
    { "id": "id2", "name": "Female", "code": "F" }
  ],
  "optionSets": [
    {
      "id": "id if you have it",
      "name": "optionset-name",
      "valueType": "optionset-value-type",
      "options": [{"id":"id1"},{"id":"id2"}]
    }
  ]
}

--
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Tue, Apr 19, 2016 at 8:56 AM, Iuri Fanti <iuri.fanti@gmail.com> wrote:

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@gmail.com>:
> 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@gmail.com> 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@gmail.com> >> >> 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@gmail.com>:
>>> > Great Knut, it's exactly what I needed! :slight_smile:
>>> >
>>> > Thank you so much!
>>> >
>>> > Iuri
>>> >
>>> > 2016-04-15 19:28 GMT+02:00 Knut Staring <knutst@gmail.com>:
>>> >> 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@gmail.com> >> >>> >> 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@lists.launchpad.net
>>> >>> 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@lists.launchpad.net
>>> 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

--
@-`-,--

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp

--
@-`-,--

It does.

···

On Tue, Apr 19, 2016 at 8:07 PM, Iuri Fanti iuri.fanti@gmail.com wrote:

Wouldn’t it be much simpler if the server gave back the id of the

newly created option as a response?

2016-04-19 7:10 GMT+02:00 Morten Olav Hansen morten@dhis2.org:

Hi Luri

Probably the best approach to creating new options (and adding to a

optionset) is:

  1. Create UIDs for every option (/api/system/id?limit=100)
  1. Create all your options { “id”: “generated-uid”, “name”: “option-name”,

“code”: “option-code” }

  1. Add or create your option set { “id”: "existing-uid, generated-uid, or

null to let the system create", “name”: “optionset-name”, “valueType”:

“wanted value type”, “options”: [your options]

  1. Wrap this in the correct payload (see below) and send to /api/metadata

with correct content-type (application/json)

{

“options”: [

{ "id": "id1", "name": "Male", "code": "M" },
{ "id": "id2", "name": "Female", "code": "F" }

],

“optionSets”: [

{
  "id": "id if you have it",
  "name": "optionset-name",
  "valueType": "optionset-value-type",
  "options": [{"id":"id1"},{"id":"id2"}]
}

]

}

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Tue, Apr 19, 2016 at 8:56 AM, Iuri Fanti iuri.fanti@gmail.com wrote:

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

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.jsonhttps://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@gmail.com 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@gmail.com

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

Great Knut, it’s exactly what I needed! :slight_smile:

Thank you so much!

Iuri

2016-04-15 19:28 GMT+02:00 Knut Staring knutst@gmail.com:

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

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@lists.launchpad.net

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@lists.launchpad.net

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

@-`-,–


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

@-`-,–


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

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

Thank you this has been so helpful