Actions
User story #7877
open[API] Make group query editable by each query piece
Pull Request:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:
Description
Currently when editing a Group's query, you'll have to upload the whole select-statement in json.
This is prone to race condition, becuase if the size of the query is big (let's say you have 4000 nodes in a query, selected by UUID), fetch the group, edit it according to your needs, and re-upload it, chances are greater then zero (depends on usecase), that it has been edited by someone other, not to say about the necessary roundtrip-time it takes unnecessarily.
Proposing a function to add/remove items from the "where"-array:
Example:
{ "select": "node", "composition": "Or", "where": [ { "objectType": "node", "attribute": "nodeId", "comparator": "eq", "value": "5ea1cb80-f4d3-11e4-be7b-228f081228de" }, { "objectType": "node", "attribute": "nodeId", "comparator": "eq", "value": "0cfc3466-3e8c-11e5-bc06-5453cf67da3d" },
Add a new where-clause:
curl -H "X-API-Token: yourToken" -X POST 'http://rudder.example.com/rudder/api/latest/groups/GroupID/QueryStatement' -d "WhereClause=' { "objectType": "node", "attribute": "nodeId", "comparator": "eq", "value": "afa11fa0-a2b1-4f00-b33f-44b91aaf443d" }'"
Delete the first where-clause:
curl -H "X-API-Token: yourToken" -X DELETE 'http://rudder.example.com/rudder/api/latest/groups/GroupID/QueryStatement' -d "WhereClause=' { "objectType": "node", "attribute": "nodeId", "comparator": "eq", "value": "5ea1cb80-f4d3-11e4-be7b-228f081228de" }'"
Change it to "and" logic:
curl -H "X-API-Token: yourToken" -X POST 'http://rudder.example.com/rudder/api/latest/groups/QueryStatement' -d "composition=And"
Replace the second by a different clause:
curl -H "X-API-Token: yourToken" -X POST 'http://rudder.example.com/rudder/api/latest/groups/QueryStatement' -d "WhereClause=' { "objectType": "node", "attribute": "nodeId", "comparator": "eq", "value": "0cfc3466-3e8c-11e5-bc06-5453cf67da3d" }'" -d "NewWhereClause=' { "objectType": "node", "attribute": "nodeId", "comparator": "neq", "value": "abbaedda-acdc-face-b00c-123456789012" }'"
Actions