Your software
My Mautic version is: latest
My PHP version is: 7.4.13
My Database type and version is: mysql 5.7
Your problem
My problem is: I encountered this error when I tried to create a campaign via API. I wondered if anyone had tried this before and what are the main variables I have to include in order to successfully create a new campaign via API. Thanks in advance
These errors are showing:
Start with reading a campaign structure via the API. Each campaign has either a form or a list (segment) as source. You need to add either of them when creating a campaign.
However current other issues prevent a successful campaign creation via API: API for campaigns broken? - Support - Mautic Community Forums
Your request body is likely missing a line like this:
"lists": 11,
or this:
"forms": 11,
where 11 is the ID of the segment (list) or form you are using to trigger the campaign.
Your request body will need more than that to create a functional campaign in Mautic, but this should get you past the error you’re receiving.
You’re going to run into another problem. ‘Nodes’ as they are called – these are the little widgety objects in the Campaign canvas – are dynamically assigned unique IDs when the campaign is created. These IDs are sequentially selected, impossible to predict, and absolutely essential for positioning and connecting the nodes to each other in the canvas.
An impossible task, it seems. I’ll report back with findings.
EP
1 Like