noticed that the REST(/api/v1/features) endpoint r...
# ask-questions
p
noticed that the REST(/api/v1/features) endpoint returns different payload for features/rules created under new 2.5 version, trying to understand why
old
rules
returned
Copy code
"rules": [
                        {
                            "type": "experiment",
                            "description": "AA test to validate implementation",
                            "id": "fr_b4zbj81clnoqpkka",
                            "condition": "{}",
                            "enabled": true,
                            "hashAttribute": "id",
                            "trackingKey": "aa-test-3",
                            "values": [
                                {
                                    "value": "{}",
                                    "name": "aa-test-4-control",
                                    "weight": 0.1,
                                    "id": "var_lnoqkm0f"
                                },
                                {
                                    "value": "{}",
                                    "name": "aa-test-4-test",
                                    "weight": 0.9,
                                    "id": "var_lnoqkm0g"
                                }
                            ],
                            "coverage": 1,
                            "namespace": {
                                "enabled": false,
                                "name": "",
                                "range": [
                                    0,
                                    0.5
                                ]
                            },
                            "scheduleRules": [],
                            "value": "{}",
                            "savedGroups": [],
                            "savedGroupTargeting": []
                        }
                    ]
and contained
values
array with
weight
and
name
fields for members
after creating a new feature with one rule it now returns:
Copy code
"rules": [
                        {
                            "type": "experiment-ref",
                            "description": "",
                            "experimentId": "exp_7jpnt1clp0fpglr",
                            "id": "fr_4la2rw1clp0fpgsl",
                            "condition": "",
                            "savedGroups": [],
                            "enabled": true,
                            "variations": [
                                {
                                    "value": "{}",
                                    "variationId": "var_lp0fpgfd"
                                },
                                {
                                    "value": "{}",
                                    "variationId": "var_lp0fpgfe"
                                },
                                {
                                    "value": "{}",
                                    "variationId": "var_lp0fpgff"
                                }
                            ],
                            "coverage": 1,
                            "savedGroupTargeting": []
                        }
                    ]
values
array is gone and instead I see
variations
array with no
weight
or
name
is this intentional? has I missed something in setting up this feature/rule?
f
that doesn’t look right
what are the end points for the two payloads?
p
it the same endpoint returning previously(<2.5) created and newly(2.5) created features
we are running our own version(not cloud)
I could give you the whole json output or our url and DM a secret if that would help
what it looks like that for old features I get rules as https://docs.growthbook.io/api#tag/FeatureExperimentRule_model and for new ones as https://docs.growthbook.io/api#tag/FeatureExperimentRefRule_model may be you'd know why?
r
Hi Victor, thanks for letting us know about this. We are looking into it and will send an update as soon as we can.
Hi Victor, we did change how experiment rules work in version 2.5. Previously, the rule type was ​`experiment`​ and everything was defined inline - traffic weights, conditions, trackingKey, etc.. Starting in 2.5, new experiment rules added to features use the new rule type ​`experiment-ref`​ instead. With this new rule type, there is a foreign key to an Experiment object (experimentId). All of the targeting and rollout info is defined on the Experiment instead. There's a separate API endpoint for fetching experiments.