Is there a way to create experiments and attribute...
# announcements
p
Is there a way to create experiments and attribute targets in growthbook via an API? https://docs.growthbook.io/app/features#targeting-attributes (I'm a total noob doing some feasibility research)
I'm mapping out how to build a plugin for strapi where users dupe content and add attributes or some kind of link to rules in growthbook
Would this be via the feature controller? https://github.com/growthbook/growthbook/blob/main/packages/back-end/src/controllers/features.ts I don't see a mention of the property. But there's a spread in the middle of the interface.
b
I believe at the moment there's no API. Might be possible to write into the DB if you're self hosting, but no idea how complex the structure is
f
Growthbook does have an API that is consumed by fornt-end. You can see definition of POST experiment here: https://github.com/growthbook/growthbook/blob/main/packages/back-end/src/controllers/experiments.ts#L379 Although there is no support for external API auth keys and current ones have only 1day expiration time so you would have to probable create a dummy user and that credentials to reauthenticate everyday. A bit clunky but definitely possible
👌 1
p
Ok so could I create an experiment and add tracking attributes via the API?
The use case is remotely creating ab tests from a CMS.
f
yes, of course you can. Make sure you send the data in a correct format: https://github.com/growthbook/growthbook/blob/main/packages/back-end/src/controllers/experiments.ts#L428 You can also debug API request sent when creating an experiment manually on the frontend to help you with sending data in a correct format.
👍 1
f
@future-candle-10380 @busy-horse-73824 coming from the future, I'd say an official write API would be a great addition. Any solid plans to make that happen?
b
We don't work at Growthbook 🙂 might be worth posting a new thread