Actions
Bug #3756
closedModifying the group of a Rule by API need to use the data "ruleTarget" instead of "targets"
Pull Request:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
Name check:
Fix check:
Regression:
Description
When getting information from a group with the API, we've got:
{ "action":"ruleDetails", "id":"e8cf66a9-f891-48c4-8adb-c86dfc1451d6", "result":"success", "data":{ "rules":[{ "id":"e8cf66a9-f891-48c4-8adb-c86dfc1451d6", "displayName":"Rule to Remove (renamed)", "shortDescription":"", "longDescription":"", "directives":["b3d2a48b-18b9-49c1-804d-91a2f797ab6a"], "targets":[], "enabled":true, "system":false }] }
But if we want to modify the targets (the group, indeed), we have to use ruleTarget instead of targets:
curl -H "X-API-Token:cEMKWn38wzgpIZPwmipe1NPeAmfzwroR" -H "X-API-Version: 1.0" -X POST http://localhost/rudder/api/rules/e8cf66a9-f891-48c4-8adb-c86dfc1451d6?prettify=true -d "targets=group:db58aaa7-f51c-42a5-af32-4d1e3bf95b10" { "action":"updateRule", "id":"e8cf66a9-f891-48c4-8adb-c86dfc1451d6", "result":"success", "data":{ "rules":[{ "id":"e8cf66a9-f891-48c4-8adb-c86dfc1451d6", "displayName":"Rule to Remove (renamed)", "shortDescription":"Little comment", "longDescription":"Big comment with strange characters: œ$%!\\/\r\nEnd of comment", "directives":["b3d2a48b-18b9-49c1-804d-91a2f797ab6a"], "targets":[], "enabled":true, "system":false }] }
curl -H "X-API-Token:cEMKWn38wzgpIZPwmipe1NPeAmfzwroR" -H "X-API-Version: 1.0" -X POST http://localhost/rudder/api/rules/e8cf66a9-f891-48c4-8adb-c86dfc1451d6?prettify=true -d "ruleTarget=group:db58aaa7-f51c-42a5-af32-4d1e3bf95b10" { "action":"updateRule", "id":"e8cf66a9-f891-48c4-8adb-c86dfc1451d6", "result":"success", "data":{ "rules":[{ "id":"e8cf66a9-f891-48c4-8adb-c86dfc1451d6", "displayName":"Rule to Remove (renamed)", "shortDescription":"Little comment", "longDescription":"Big comment with strange characters: œ$%!\\/\r\nEnd of comment", "directives":["b3d2a48b-18b9-49c1-804d-91a2f797ab6a"], "targets":["group:db58aaa7-f51c-42a5-af32-4d1e3bf95b10"], "enabled":true, "system":false }] }
Actions