0 Replies Latest reply on Apr 17, 2019 5:47 AM by Shawn Gerlock

    DELETE API call for third-level entities

    Shawn Gerlock Seasoned Veteran

      I have a use case where I would like to delete an attribute value using the REST API. Not the attribute itself, just the value.

       

      The following command deletes the attribute:

      http://localhost:1501/rest/V1.0/list/StructureGroup/StructureGroupAttribute/byItems?structure=MYSTRUCTURE&qualificationFilter=name("MyAttribute")&items='SG4402480100770001'@'MYSTRUCTURE'

       

      However, the field I really need to delete is StructureGroupAttributeValue.Value. But there seems to be no way to access this from the API, as it doesn’t appear to support 3-level nesting of the entities (i.e. /StructureGroup/StructureGroupAttribute/StructureGroupAttributeValue). As a workaround, I’m just doing a POST and writing an empty string to the attribute value, but that doesn’t actually delete the record and instead just populates the attribute with an empty string rather than deletes it. This in turn is causing some other headaches in terms of comparison with other systems as an empty string is treated differently from a null. We are about to do some fairly comprehensive data manipulation tasks with attributes in this manner, so if there's a "correct" way to accomplish this I would be grateful to any insight on this.

       

      Side note - my specific use case is for StructureGroupAttributeValue but in reality could apply to any third-level entity, e.g. Product2GAttributeValue, ArticleAttributeValue.