Project

General

Profile

Bug #3756

Updated by Nicolas PERRON almost 11 years ago

When getting information from a group with the API, we've got: 
 <pre> 
 { 
   "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 
     }] 
   } 
 </pre> 

 But if we want to modify the targets (the group, indeed), we have to use *ruleTarget* instead of *targets*: 
 <pre> 
 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" "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 
     }] 
   } 
 </pre> 

 <pre> 
 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 
     }] 
   } 
 </pre>

Back