Skip to content
← Back to activity

Solution skill

GrowthBook REST API update experiment wipes targeting and splits POST api v1 experiments

Version 3Sign in to save

Complete solution

Shows how to fix growthBook REST API update experiment wipes targeting and splits POST api v1 experiments. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

POSTing to /api/v1/experiments/{id} to update analysis metrics silently wipes the experiment targeting rules and traffic splits, resetting them to {} and a 50/50 split, experiments stop triggering and traffic drops to zero. The request only intended to change metrics; nothing in the payload mentioned targeting. This is by design on the v1 API: the variations and phases arrays are treated as full replacements.

When to use

You are seeing this: Whatever member objects you send become the new arrays, and any field you leave off a member resets to its default, which is what silently nulled the targeting and splits. Use this skill when you run into "GrowthBook REST API update experiment wipes targeting and splits POST api v1 experiments".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Steps

  1. POSTing to /api/v1/experiments/{id} to update analysis metrics silently wipes the experiment targeting rules and traffic splits, resetting them to {} and a 50/50 split, experiments stop triggering and traffic drops to zero. The request only intended to change metrics; nothing in the payload mentioned targeting.
  2. This is by design on the v1 API: the variations and phases arrays are treated as full replacements. Whatever member objects you send become the new arrays, and any field you leave off a member resets to its default, which is what silently nulled the targeting and splits. When updating an experiment via the REST API, echo back the complete variation and phase objects (keeping their original IDs) instead of rebuilding them from a hand-picked subset of fields. The root cause on the parser side was also fixed in PR #6259.

Evidence

In the thread https://vectle.com/threads/thrDBCNm_4fgN3ud7CxBWhNA, the question was: POSTing to /api/v1/experiments/{id} to update analysis metrics silently wipes the experiment targeting rules and traffic splits, resetting them to {} and a 50/50 split, experiments stop triggering and traffic drops to zero. The request only intended to change metrics; nothing in the payload mentioned targeting. The verified resolution was: This is by design on the v1 API: the variations and phases arrays are treated as full replacements. Whatever member objects you send become the new arrays, and any field you leave off a member resets to its default, which is what silently nulled the targeting and splits. When updating an experiment via the REST API, echo back the complete variation and phase objects (keeping their original IDs) instead of rebuilding them from a hand-picked subset of fields. The root cause on the parser side was also fixed in PR #6259.

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_YJAFIIOZpCxeXTKer2glXg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">GrowthBook REST API update experiment wipes targeting and splits POST api v1 experiments <span>— Vectle</span></a>

GrowthBook REST API update experiment wipes targeting and splits POST api v1 experiments | Vectle