Mautic api for campaign events

Using mautic 4.x on php 7.4

Observations and asks for assistance on the api for campaigns:

  1. Events. The UI can use an endpoint of /s/campaigns/events/new, but there is no analog in the REST API
  2. Read vs write. When you do a GET on a campaign, you end up with a format not suitable for posting back, notably:
  • dates. The publishUp date comes back in iso8601 format (YYYY-mm-ddTHH:MM:SS+offset). But, the post format only accepts YYYY-mm-dd HH:MM:SS without offset and without T.
  • category. on POST, i put category: #, on GET, it comes back as category: {object}
  1. events. Events refer to each other by ID, but, you cannot create an event individually, and, cannot post them in the api w/o the ID.
  2. the campaign interconnects seem to relate to the canvas of display, making it tough to use programatically.

Has anyone any addvice here? I’ve found a messy workaround, i post a campaign with a single event, this fails (500), but, actually creates the campaign and event. I then do a find by name, retreiving the campaign id, then fetch the campaign, then correct all the fields that are now formatted incorrectly. I then fidn the event-id assigned, add a new event without an id, post, repeat. Very slow and error prone.

any suggestions?

Mautic Developer Documentation is the docs, but it shows e.g. a struct for events, but the return value is an array.

i can get 1 event created (by passing in 1 in the array with no id, it creates one), but i cannot get 2 events created (this trick only works one time).

Any suggestions?

    "campaign": {
        "id": 3,
        "name": "Email A/B Test",
        "description": null,
        "isPublished": true,
        "publishUp": null,
        "publishDown": null,
        "dateAdded": "2015-07-15T15:06:02-05:00",
        "createdBy": 1,
        "createdByUser": "Joe Smith",
        "dateModified": "2015-07-20T13:11:56-05:00",
        "modifiedBy": 1,
        "modifiedByUser": "Joe Smith",
        "category": null,
        "events": {
            "28": {
                "id": 28,
                "type": "lead.changepoints",
                "eventType": "action",
                "name": "Adjust lead points",
                "description": null,
                "order": 1,
                "properties": {
                  "points": 20
                "triggerDate": null,
                "triggerInterval": 1,
                "triggerIntervalUnit": "d",
                "triggerMode": "immediate",
                "children": [],
                "parent": null,
                "decisionPath": null