1

Is this possible to do? Each time I schedule an automation through the API it only seems to work if I set a "Recurrence" value, although I only want the automation to run once.

To get around this I've been setting the Recurrence to an arbitrary 5000 days while also setting the "Occurrences" to 1 so that the automation ends after it is run(example below). This has been working fine but I'd like to avoid doing it if possible.

enter image description here

  • are you looking to have it do a 'run once' where it runs immediately or do you want to schedule it for a future date and have it only run that one time? – Gortonington Dec 5 '19 at 20:24
  • Schedule it for a future date and have it only run one time. – Brett Dec 5 '19 at 21:19
2

To set this, you need to have a recurrence set, but you can set this to 1, which is exactly what is set inside the UI version.

Example SOAP:

  <ScheduleRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
     <Action>start</Action>
     <Schedule>
        <!-- Can leave blank to use current schedule -->
        <PartnerKey xsi:nil="true"/>
        <ObjectID xsi:nil="true"/>
        <Recurrence xsi:type="q1:DailyRecurrence" xmlns:q1="http://exacttarget.com/wsdl/partnerAPI">
            <q1:DailyRecurrencePatternType>Interval</q1:DailyRecurrencePatternType>
            <q1:DayInterval>1</q1:DayInterval>
        </Recurrence>
        <RecurrenceType>Daily</RecurrenceType>
        <RecurrenceRangeType>EndAfter</RecurrenceRangeType>
        <StartDateTime>2030-05-16T14:32:00-04:00</StartDateTime>
        <Occurrences>1</Occurrences>
     </Schedule>
     <Interactions>
        <Interaction xsi:type="Automation">
           <ObjectID>XXXXXXXXXXXXXXXXX</ObjectID>
        </Interaction>
     </Interactions>
  </ScheduleRequestMsg>



Screen shot from UI setting:
enter image description here

ScreenShot of schedule via API:
enter image description here

As you can see there is no difference between the SOAP setting and the UI setting.

The REST Endpoint that @RachidMamai spoke of is great, but it has no way to actually set the Automation to 'active'. Which would require extra action.

| improve this answer | |
  • 1
    A thousand thank yous to you Gortonington. This works perfectly, you're the best! – Brett Dec 9 '19 at 1:47
1

You can achieve this via the REST API using the undocumented endpoint /automation/v1/automations/{{automation_object_id}}.

Do a PATCH request to:

YOUR_DOMAIN/automation/v1/automations/YOUR_AUTOMATION_OBJECT_ID

The request's JSON payload is similar to:

{
  "name": "AUTOMATION_NAME",
  "description": "DESC",
  "key": "YOUR_AUTOMATION_KEY",
  "steps": [],
  "startSource": {
    "typeId": 1,
    "schedule": {
      "iCalRecur": "FREQ=HOURLY;INTERVAL=1;COUNT=1",
      "startDate": "2019-12-06T14:00:00",
      "timeZoneId": 7
    }
  },
  "categoryId": 486
}

Of course, you can change the FREQ to DAILY, WEEKLY,..

Using this payload, your automation will only be scheduled to run once.

| improve this answer | |
  • I think this will set it in a 'paused' state though. The schedule will be there, but not activated yet – Gortonington Dec 6 '19 at 17:10
  • Correct, I've tried multiple payloads and even forced the ScheduleStatus to "active" without sucess. There is no way of achieving this via REST API at the moment. Automation Studio is using a REST call to a beta endpoint that is not accessible from outside SFMC.. – Rachid Mamai Dec 9 '19 at 10:41
  • Yeah, this is a pain point that I have been pushing on SFMC, especially around a Triggered File Drop automation as there is not a SOAP nor a REST solution (outside internal endpoints) to activate it/pause it. – Gortonington Dec 10 '19 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.