-
1. Re: Deleting a preset value for group feature via API
Ronald Lubin Jun 6, 2017 6:10 AM (in response to Ronald Lubin)Any help on this question?
Ron
-
2. Re: Deleting a preset value for group feature via API
Ben Daelemans Jun 19, 2019 7:01 AM (in response to Ronald Lubin)1 of 1 people found this helpfulHi Ron,
I had the same issue, and i've written a web-based solution for this.
Whatever API request i used, I just couldn't delete a preset value from the list in a structure group.
But what I could do was update the preset value list with the complete current list except for the preset value(s) you don't want in there (leave them out of the update request).
So in my php/jquery script, I use 2 API request:
- The 1st one to get the complete preset value list of a certain feature in the specified structure group
- The 2nd one to update the list for that feature using the retrieved data, but leaving out the values I don't want
1. To get the current list of preset values from a certain features in a structure group, I use following query:
(you can repeat the "StructureValueLang.Name" part with other language codes for multiple language)the method:
GET
The url:
rest/V1.0/list/StructureGroup/StructureGroupAttribute/byIdentifiers?identifiers='StructureGroupIdentifier'&structureProxy='StructureDatabaseID'&fields=StructureGroupAttributePresetValue.StructureValueProxy->StructureValue.Identifier,StructureGroupAttributePresetValue.StructureValueProxy->StructureValueLang.Name(LanguageCode),StructureGroupAttributeLang.Name&qualificationFilter=language(LanguageCode),name("ExactFeatureName_InLanguage")
2. To update (delete) the current list to a new list without the preset values you'll want to delete:
(again the 'object' part can be repeated for every language)
the method:
POST
the url:
rest/V1.0/list/StructureGroup/StructureGroupAttribute/
the body:
{"columns":[{"identifier": "StructureGroupAttribute.DomainValue"},{"identifier": "StructureGroupAttributeLang.DomainValue"}],"rows":[{"object":{ "id": "StructureGroupDatabaseID"},"qualification":{ "name": "FeatureName_InLanguage", "language": "English"},"values": ["PresetValueIdentifier","PresetValueName_InLanguage"]}]}
-> the "Value" part of the above query contains 2 parameters: the identifier and the name of the preset values.
Both should be a ";" separated list of all identifiers/values you'll want in your list for that feature.
For example:
PresetValueIdentifier = "ID_001;ID_002;ID_003;ID_004"
PresetValueName_InLanguage= "Black;Blue;Red;Yellow"
The current preset value list for the specified feature will then be overwritten by the list you provide in the body of the above update query.
-> if you want to clear all current preset values in the list for 1 feature, u can use the same query above.
But the difference will be the "value" parameter should be: ,"values":["",""].
This updates the entire list with nothing.
I hope this helps you find your way around the API to handle preset values in the selectable list of a certain structure group.
Regards,
Ben Daelemans
-
3. Re: Deleting a preset value for group feature via API
Joe Griffith Oct 29, 2019 10:28 AM (in response to Ben Daelemans)Hi Ben
This post is exactly what I've been looking for!
I'm trying to test the GET call but I'm not getting any rows to return, for us the example has:
structure group identifier = 17529421
structureproxy=10200
LangugageName=English (we also have a langID for that of 9)
ExactFeatureName_InLanguage = ADIAPP
URL I made:
http://arlpimcoret01.ecorp.cat.com:1512/rest/V1.0/list/StructureGroup/StructureGroupAttribute/byIdentifiers?identifiers=17529421&structureProxy=10200&fields=StructureGroupAttributePresetValue.StructureValueProxy-%3EStructureValue.Identifier,StructureGroupAttributePresetValue.StructureValueProxy-%3EStructureValueLang.Name(English),StructureGroupAttributeLang.Name&qualificationFilter=language(English),name(%22ADIAPP%22)http://localhost:1512/rest/V1.0/list/StructureGroup/StructureGroupAttribute/byIdentifiers?identifiers=17529421&structureProxy=10200&fields=StructureGroupAttributePresetValue.StructureValueProxy-%3EStructureValue.Identifier,StructureGroupAttributePresetValue.StructureValueProxy-%3EStructureValueLang.Name(English),StructureGroupAttributeLang.Name&qualificationFilter=language(English),name(%22ADIAPP%22)
The result gives 0 rows, when I trim everything starting from "&fields..." on ward I get the list of features for that group.
Return message:
Am I missing something?
Thanks
Joe
-
4. Re: Deleting a preset value for group feature via API
Sai Prasad Oct 31, 2019 6:48 PM (in response to Ronald Lubin)Hi Ron,
Could you try with following steps and see if that works too:
Get all the information needed with a GET request and then transform that information to the body-parameter for a POST request to update the values. Providing me with the result needed:
- Grab all the preset value assignments to a certain Feature (name provided) from a certain StructureGroup (identifier provided) using the GET request
- Transform that response to a JSON string (skipping the value that needs to be deleted, to get a valid list of all remaining ‘correct’ values)
- Use that JSON string as a body for a POST request to update the assignments
Thank you
Sai Prasad
-
5. Re: Deleting a preset value for group feature via API
Sai Prasad Nov 8, 2019 2:12 AM (in response to Sai Prasad)Hi Ron,
The above response work for you?
Thank you!
Sai Prasad
-
6. Re: Deleting a preset value for group feature via API
Ronald Lubin Dec 2, 2019 6:28 AM (in response to Sai Prasad)Let me look into this and get back to you.
Ron