Invokes the Perform method on a Marketing Cloud Engagement API Object and returns the API status code.

The InvokePerform() has three parameters:

  • apiObject (API Object): Required. The API Object to invoke the Perform method on.
  • actionToPerform (string): Required. Action to perform, with valid parameter values varying depending on the object type.
  • statusMessage (AMPscript variable): An AMPscript variable that stores the API status message.

This example creates a Campaign API Object and sets a property on it. It then invokes the Perform method on the Object, passing the "stop" action. The function then outputs the status code. If the status code doesn’t equal "OK," it outputs the status message and error code.