How do I send payload with AOC to the api/dataValues endpoint in a custom app

I read in the doc that I can send individual data values as a JSON payload using the following resource using Content-Type: application/json with endpoint supports specifying attribute option combos in a nested structure like:

{
    "dataElement": "BOSZApCrBni",
    "categoryOptionCombo": "TkDhg29x18A",
    "attribute": {
        "combo": "O4VaNks6tta",
        "options": ["C6nZpLKjEJr", "i4Nbp8S2G6A"]
    },
    "dataSet": "lyLU2wR22tC",
    "period": "202201",
    "orgUnit": "DiszpKrYNg8",
    "value": "15",
    "comment": "Good"
}

I have two questions.

  1. Where for example in the Maintenance app do I get the values for the combo and options in the attribute object.
 "attribute": {
        "combo": "O4VaNks6tta",
        "options": ["C6nZpLKjEJr", "i4Nbp8S2G6A"]
    }
  1. If I set up a AOC with option “C6nZpLKjEJr” and “i4Nbp8S2G6A” which I supposed will go into the options value in 1 above, when sending the payload do I need to attached the two values always?
    Say for instance in my custom app, a user is filling the form AOC option “C6nZpLKjEJr”, do I send the attribute part like this:
 "attribute": {
        "combo": "O4VaNks6tta",
        "options": ["C6nZpLKjEJr"]
    }

or like this

 "attribute": {
        "combo": "O4VaNks6tta",
        "options": ["C6nZpLKjEJr", "i4Nbp8S2G6A"]
    }

Any help with this?

Follow the same steps for each…

I think this is okay, as long as they are valid options, the docs says " It is necessary to ensure that the category options are all part of the category combination." could you test it?

1 Like

I read in the doc that I can send individual data values as a JSON payload using the following resource using Content-Type: application/json like

{
    "dataElement": "fbfJHSPpUQD",
    "categoryOptionCombo": "PT59n8BQbqM",
    "period": "202201",
    "orgUnit": "DiszpKrYNg8",
    "value": "10",
    "comment": "OK"
}

The endpoint supports specifying attribute option combos in a nested structure.

{
    "dataElement": "BOSZApCrBni",
    "categoryOptionCombo": "TkDhg29x18A",
    "attribute": {
        "combo": "O4VaNks6tta",
        "options": ["C6nZpLKjEJr", "i4Nbp8S2G6A"]
    },
    "dataSet": "lyLU2wR22tC",
    "period": "202201",
    "orgUnit": "DiszpKrYNg8",
    "value": "15",
    "comment": "Good"
}

I have a dataset with AttibuteOptionCombos for two separate teams to submit data for the same DE, Dataset and Period.

  1. In the attribute option combos above where is the combo and options retrieved from in the maintenance app for instance
"attribute": {
        "combo": "O4VaNks6tta",
        "options": ["C6nZpLKjEJr", "i4Nbp8S2G6A"]
    },
  1. I am using a custom data capture app for sending this data. If each team are to fill the same form and I just want to append there respective attribute option combos, do I need to put the two options in the array or can I just send one option for each team. For example:

{
    "dataElement": "BOSZApCrBni",
    "categoryOptionCombo": "TkDhg29x18A",
    "attribute": {
        "combo": "O4VaNks6tta",
        "options": ["i4Nbp8S2G6A"]
    },
    "dataSet": "lyLU2wR22tC",
    "period": "202201",
    "orgUnit": "DiszpKrYNg8",
    "value": "15",
    "comment": "Good"
}

Where the "i4Nbp8S2G6A" option represent the team submitting the data.

Note that “attribute” is a very different thing from “atributeOptionCombo”. (Sorry that the word is over-used.) You always specify an attributeOptionCombo by its UID, not the individual options, such as:

    "attributeOptionCombo": "TkDhg29x18A"

An attributeOptionCombo is a CategoryOptionCombo that is used, not for disaggregating a data element, but for adding one or more extra dimensions to a data set. (See the User Guide section Additional Data Dimensions.)

The UIDs for attribute option combos are found in the same way as the UIDs for category option combos: Maintenance app → Category → Category option combination. When you list the category option combinations, you can click on the three dots and select Show details to see the UID.

2 Likes

I tested it this way with a single option and it is working now in my custom App. I am still confused though on the use case for multiple options for the attribute.

I got those values by sending a request to the dataset.

1 Like

I think I now understand the concept better now. I was adding selecting the checkbox to use COC as data dimension before for all my COCs but later had to remove it since I only wanted to use the AOC to add dimension to the data. Gradually I will master the system working.

1 Like

Thanks for your response. The setting is now working. I will post the issue I am having in a new post.

1 Like