Problem
Admin API allow updating existing Split Definitions, when using the curl command below to add a key into an existing individual target section, it always fail with 400 Bad Request
curl -v -X PATCH -d '[{"op": "add", "path": "/treatments/0/keys/-", "value": "key1"}]' -H "Authorization: Bearer ADMIN API KEY" -H "Content-Type: application/json" https://api.split.io/internal/api/v2/splits/ws/[Workspace ID]/[Split Name]/environments/[Environment Name]
HTTP/2 400
< strict-transport-security: max-age=15770000; includeSubDomains
< vary: Cookie
< content-length: 0
* Connection #0 to host api.split.io left intact
Root Cause
With the introduction of Approval Requests in Split UI, the Workspace configuration has Require title and comments for split, segment and metric changes checkbox option. If it is checked, it is required from the UI and Admin API to provide a title and comment when changing Split Definitions.
Solution
Add the title and comment optional parameters in the URL query as below
curl -v -X PATCH -d '[{"op": "add", "path": "/treatments/0/keys/-", "value": "key1"}]' -H "Authorization: Bearer ADMIN API KEY" -H "Content-Type: application/json" https://api.split.io/internal/api/v2/splits/ws/[Workspace ID]/[Split Name]/environments/[Environment Name]?title=Split-Engineer-Testing&comment=Split-Engineer-Testing-Comment
Comments
0 comments
Please sign in to leave a comment.