[Bug 1563559] [NEW] [Api] Adding/Removing a legendSet to an existing dataElement using PUT

Public bug reported:

I'm attempting to add a legendSet to an existing dataElement. While the
api seems to return updated: 1 it does not actually add the legendSet to
the object.

Reproduce add:
+ GET https://play.dhis2.org/dev/api/dataElements/FTRrcoaog83.json?fields=:owner
+ Add part to the payload "legendSet": {"id": "Yf6UHoPkdS6"}
+ PUT the payload back to the server
+ The dataElement is not updated with the new LegendSet

Reproduce remove:
+ GET https://play.dhis2.org/dev/api/dataElements/qrur9Dvnyt5.json?fields=:owner
+ Remove legendSet part or set to null
+ PUT the payload back to the server
+ LegenSet is still available on the object

Might be related to the earlier reported https://bugs.launchpad.net/dhis2/+bug/1563546

** Affects: dhis2
     Importance: Undecided
         Status: New

** Tags: api

···

--
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1563559

Title:
  [Api] Adding/Removing a legendSet to an existing dataElement using PUT

Status in DHIS:
  New

Bug description:
  I'm attempting to add a legendSet to an existing dataElement. While
  the api seems to return updated: 1 it does not actually add the
  legendSet to the object.

  Reproduce add:
  + GET https://play.dhis2.org/dev/api/dataElements/FTRrcoaog83.json?fields=:owner
  + Add part to the payload "legendSet": {"id": "Yf6UHoPkdS6"}
  + PUT the payload back to the server
  + The dataElement is not updated with the new LegendSet

  Reproduce remove:
  + GET https://play.dhis2.org/dev/api/dataElements/qrur9Dvnyt5.json?fields=:owner
  + Remove legendSet part or set to null
  + PUT the payload back to the server
  + LegenSet is still available on the object

  Might be related to the earlier reported https://bugs.launchpad.net/dhis2/+bug/1563546

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1563559/+subscriptions

** Summary changed:

- [Api] Adding/Removing a legendSet to an existing dataElement using PUT
+ [Api] Adding/Removing a legendSet to an existing dataElement/indicator using PUT

** Description changed:

  I'm attempting to add a legendSet to an existing dataElement. While the
  api seems to return updated: 1 it does not actually add the legendSet to
  the object.
  
  Reproduce add:
  + GET https://play.dhis2.org/dev/api/dataElements/FTRrcoaog83.json?fields=:owner
  + Add part to the payload "legendSet": {"id": "Yf6UHoPkdS6"}
  + PUT the payload back to the server
  + The dataElement is not updated with the new LegendSet
  
  Reproduce remove:
  + GET https://play.dhis2.org/dev/api/dataElements/qrur9Dvnyt5.json?fields=:owner
  + Remove legendSet part or set to null
  + PUT the payload back to the server
  + LegenSet is still available on the object
  
+ Might be related to the earlier reported
+ https://bugs.launchpad.net/dhis2/+bug/1563546
  
- Might be related to the earlier reported https://bugs.launchpad.net/dhis2/+bug/1563546
+ EDIT: Also seems to apply to /api/indicator

···

--
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1563559

Title:
  [Api] Adding/Removing a legendSet to an existing dataElement/indicator
  using PUT

Status in DHIS:
  New

Bug description:
  I'm attempting to add a legendSet to an existing dataElement. While
  the api seems to return updated: 1 it does not actually add the
  legendSet to the object.

  Reproduce add:
  + GET https://play.dhis2.org/dev/api/dataElements/FTRrcoaog83.json?fields=:owner
  + Add part to the payload "legendSet": {"id": "Yf6UHoPkdS6"}
  + PUT the payload back to the server
  + The dataElement is not updated with the new LegendSet

  Reproduce remove:
  + GET https://play.dhis2.org/dev/api/dataElements/qrur9Dvnyt5.json?fields=:owner
  + Remove legendSet part or set to null
  + PUT the payload back to the server
  + LegenSet is still available on the object

  Might be related to the earlier reported
  https://bugs.launchpad.net/dhis2/+bug/1563546

  EDIT: Also seems to apply to /api/indicator

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1563559/+subscriptions

Hi,

I was not able to reproduce this. I was easily able to change a data
elements legendset from one ID to another.

When it comes to clearing out, remember that default mergeMode is MERGE,
which means null values will be ignored.. you need to set
mergeMode=REPLACE if you want to clear out properties.

Could you try to PUT again, and see if you can change the legend set? If
you can't change, please give me a bit more details.. and I will try
again

** Changed in: dhis2
       Status: New => Incomplete

** Changed in: dhis2
     Assignee: (unassigned) => Morten Olav Hansen (mortenoh)

···

--
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1563559

Title:
  [Api] Adding/Removing a legendSet to an existing dataElement/indicator
  using PUT

Status in DHIS:
  Incomplete

Bug description:
  I'm attempting to add a legendSet to an existing dataElement. While
  the api seems to return updated: 1 it does not actually add the
  legendSet to the object.

  Reproduce add:
  + GET https://play.dhis2.org/dev/api/dataElements/FTRrcoaog83.json?fields=:owner
  + Add part to the payload "legendSet": {"id": "Yf6UHoPkdS6"}
  + PUT the payload back to the server
  + The dataElement is not updated with the new LegendSet

  Reproduce remove:
  + GET https://play.dhis2.org/dev/api/dataElements/qrur9Dvnyt5.json?fields=:owner
  + Remove legendSet part or set to null
  + PUT the payload back to the server
  + LegenSet is still available on the object

  Might be related to the earlier reported
  https://bugs.launchpad.net/dhis2/+bug/1563546

  EDIT: Also seems to apply to /api/indicator

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1563559/+subscriptions

Change worked fine, but i was under the impression that clearing it out
should remove it.

At least especially on a PUT procedure where i'm basically PUTting my local
state to the server?

···

On Wed, Mar 30, 2016 at 7:18 AM, Morten Olav Hansen < 1563559@bugs.launchpad.net> wrote:

Hi,

I was not able to reproduce this. I was easily able to change a data
elements legendset from one ID to another.

When it comes to clearing out, remember that default mergeMode is MERGE,
which means null values will be ignored.. you need to set
mergeMode=REPLACE if you want to clear out properties.

Could you try to PUT again, and see if you can change the legend set? If
you can't change, please give me a bit more details.. and I will try
again

** Changed in: dhis2
       Status: New => Incomplete

** Changed in: dhis2
     Assignee: (unassigned) => Morten Olav Hansen (mortenoh)

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/1563559

Title:
  [Api] Adding/Removing a legendSet to an existing dataElement/indicator
  using PUT

Status in DHIS:
  Incomplete

Bug description:
  I'm attempting to add a legendSet to an existing dataElement. While
  the api seems to return updated: 1 it does not actually add the
  legendSet to the object.

  Reproduce add:
  + GET
https://play.dhis2.org/dev/api/dataElements/FTRrcoaog83.json?fields=:owner
  + Add part to the payload "legendSet": {"id": "Yf6UHoPkdS6"}
  + PUT the payload back to the server
  + The dataElement is not updated with the new LegendSet

  Reproduce remove:
  + GET
https://play.dhis2.org/dev/api/dataElements/qrur9Dvnyt5.json?fields=:owner
  + Remove legendSet part or set to null
  + PUT the payload back to the server
  + LegenSet is still available on the object

  Might be related to the earlier reported
  https://bugs.launchpad.net/dhis2/+bug/1563546

  EDIT: Also seems to apply to /api/indicator

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1563559/+subscriptions

--
Regards,

Mark Polak
Software developer, DHIS 2
University of Oslo
http://www.dhis2.org <https://www.dhis2.org/>
mark@dhis2.org

--
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1563559

Title:
  [Api] Adding/Removing a legendSet to an existing dataElement/indicator
  using PUT

Status in DHIS:
  Incomplete

Bug description:
  I'm attempting to add a legendSet to an existing dataElement. While
  the api seems to return updated: 1 it does not actually add the
  legendSet to the object.

  Reproduce add:
  + GET https://play.dhis2.org/dev/api/dataElements/FTRrcoaog83.json?fields=:owner
  + Add part to the payload "legendSet": {"id": "Yf6UHoPkdS6"}
  + PUT the payload back to the server
  + The dataElement is not updated with the new LegendSet

  Reproduce remove:
  + GET https://play.dhis2.org/dev/api/dataElements/qrur9Dvnyt5.json?fields=:owner
  + Remove legendSet part or set to null
  + PUT the payload back to the server
  + LegenSet is still available on the object

  Might be related to the earlier reported
  https://bugs.launchpad.net/dhis2/+bug/1563546

  EDIT: Also seems to apply to /api/indicator

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1563559/+subscriptions

Yeah, well the default for our entire API is mergeMode=MERGE (it has
been since day 1), so no.. it will not just replace the object with what
you send.. by default..

You need to use mergeMode=REPLACE for that

I'm sure it could be discussed if that should be the default, but I
think a this point it would be a breaking change.. not something we
really want

** Changed in: dhis2
       Status: Incomplete => Invalid

···

--
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1563559

Title:
  [Api] Adding/Removing a legendSet to an existing dataElement/indicator
  using PUT

Status in DHIS:
  Invalid

Bug description:
  I'm attempting to add a legendSet to an existing dataElement. While
  the api seems to return updated: 1 it does not actually add the
  legendSet to the object.

  Reproduce add:
  + GET https://play.dhis2.org/dev/api/dataElements/FTRrcoaog83.json?fields=:owner
  + Add part to the payload "legendSet": {"id": "Yf6UHoPkdS6"}
  + PUT the payload back to the server
  + The dataElement is not updated with the new LegendSet

  Reproduce remove:
  + GET https://play.dhis2.org/dev/api/dataElements/qrur9Dvnyt5.json?fields=:owner
  + Remove legendSet part or set to null
  + PUT the payload back to the server
  + LegenSet is still available on the object

  Might be related to the earlier reported
  https://bugs.launchpad.net/dhis2/+bug/1563546

  EDIT: Also seems to apply to /api/indicator

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1563559/+subscriptions

Agreed. Will adjust for it :wink: Funny i haven't run into that before.

···

On Wed, Mar 30, 2016 at 9:32 AM, Morten Olav Hansen < 1563559@bugs.launchpad.net> wrote:

Yeah, well the default for our entire API is mergeMode=MERGE (it has
been since day 1), so no.. it will not just replace the object with what
you send.. by default..

You need to use mergeMode=REPLACE for that

I'm sure it could be discussed if that should be the default, but I
think a this point it would be a breaking change.. not something we
really want

** Changed in: dhis2
       Status: Incomplete => Invalid

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/1563559

Title:
  [Api] Adding/Removing a legendSet to an existing dataElement/indicator
  using PUT

Status in DHIS:
  Invalid

Bug description:
  I'm attempting to add a legendSet to an existing dataElement. While
  the api seems to return updated: 1 it does not actually add the
  legendSet to the object.

  Reproduce add:
  + GET
https://play.dhis2.org/dev/api/dataElements/FTRrcoaog83.json?fields=:owner
  + Add part to the payload "legendSet": {"id": "Yf6UHoPkdS6"}
  + PUT the payload back to the server
  + The dataElement is not updated with the new LegendSet

  Reproduce remove:
  + GET
https://play.dhis2.org/dev/api/dataElements/qrur9Dvnyt5.json?fields=:owner
  + Remove legendSet part or set to null
  + PUT the payload back to the server
  + LegenSet is still available on the object

  Might be related to the earlier reported
  https://bugs.launchpad.net/dhis2/+bug/1563546

  EDIT: Also seems to apply to /api/indicator

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1563559/+subscriptions

--
Regards,

Mark Polak
Software developer, DHIS 2
University of Oslo
http://www.dhis2.org <https://www.dhis2.org/>
mark@dhis2.org

--
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1563559

Title:
  [Api] Adding/Removing a legendSet to an existing dataElement/indicator
  using PUT

Status in DHIS:
  Invalid

Bug description:
  I'm attempting to add a legendSet to an existing dataElement. While
  the api seems to return updated: 1 it does not actually add the
  legendSet to the object.

  Reproduce add:
  + GET https://play.dhis2.org/dev/api/dataElements/FTRrcoaog83.json?fields=:owner
  + Add part to the payload "legendSet": {"id": "Yf6UHoPkdS6"}
  + PUT the payload back to the server
  + The dataElement is not updated with the new LegendSet

  Reproduce remove:
  + GET https://play.dhis2.org/dev/api/dataElements/qrur9Dvnyt5.json?fields=:owner
  + Remove legendSet part or set to null
  + PUT the payload back to the server
  + LegenSet is still available on the object

  Might be related to the earlier reported
  https://bugs.launchpad.net/dhis2/+bug/1563546

  EDIT: Also seems to apply to /api/indicator

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1563559/+subscriptions