Reputation: 125
I am trying to create A/B test using facebook graph API. The documentation I follow: https://developers.facebook.com/docs/marketing-api/guides/split-testing
The documentation mentions following curl command:
curl \
-F 'name="new study"' \
-F 'description="test creative"' \
-F 'start_time=1478387569' \
-F 'end_time=1479597169' \
-F 'type=SPLIT_TEST' \
-F 'cells=[{name:"Group A",treatment_percentage:50,adsets:[<AD_SET_ID>]},{name:"Group B",treatment_percentage:50,adsets:[<AD_SET_ID>]}]' \
-F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/<API_VERSION>/<BUSINESS_ID>/ad_studies
I am able to run this command successfully and get the split test ID which has been created, but I am unable to find the created split test:https://www.facebook.com/test-and-learn
The created test is fetch-able through API GET endpoint, but it does not exist on facebook console. Here is the place where I am trying to find it:
My goal is to create facebook ads A/B test through graph API. Is there any other documentation for this? or am I understanding something wrong there?
Upvotes: 0
Views: 52
Reputation: 125
I have found the solution to this problem: Use USER_ID instead of BUSINESS_ID and replace type="SPLIT_TEST_V2"
https://graph.facebook.com/<API_VERSION>/<USER_ID>/ad_studies
{
"name": "new study",
"description": "description of my study",
"start_time": 1729843787,
"end_time": 1730280182,
"cooldown_start_time": 1729843787,
"observation_end_time": 1730280182,
"type": "SPLIT_TEST_V2",
"cells": [
{
//"name": "Group A",
"treatment_percentage": 50,
"campaigns": [
"120212284058530726"
]
},
{
//"name": "Group B",
"treatment_percentage": 50,
"campaigns": [
"120212284108390726"
]
}
]
}
Upvotes: 0