← Back to team overview

dhis2-devs team mailing list archive

Re: Creating options and optionsets via api

 

Hi

As with most of our current metadata, this process is not documented. It
does however follow the normal flow of all our metadata, which means that
objects that are based on UID most be referenced, instead of directly
contained.

A sample payload would be something like this:

{
  "options": [
    { "name": "Option 1", "code": "option_1" },
    { "name": "Option 2", "code": "option_2" },
    { "name": "Option 3", "code": "option_3" }
  ],
  "optionSets": [
    { "name": "Options", "options": [ { ... here you must match either on
id or code ... }]
  ]
}

Remember that if you want to create it all in one go, and don't have the
ID, you can set matching strategy to code.

If you want to get a larger sample, you can have a look at the output from
this (admin / district):
https://apps.dhis2.org/dev/api/metadata.json?assumeTrue=false&options=true&optionSets=true

The way options/optionSets have changed in 2.17 to allow for them to be
translated as our other metadata.

--
Morten

On Thu, Sep 25, 2014 at 12:15 AM, Mahendra Kariya <
mahendra.kariya@xxxxxxxxxxxxxxxx> wrote:

> Hi,
>
> Could you please point us to the documentation for the API to create
> options and option sets?
> We tried searching the user manual
> <https://www.dhis2.org/doc/snapshot/en/user/html/ch31.html>, but couldn't
> find anything.
>
>
>
> Thanks,
> Mahendra
> *Thought*Works
>

Follow ups