0

I created this PHP code and run this.

PHP Code

const OBJ_TYPE    = "Automation";
const ACTION_TYPE = "start";
const OBJECT_ID   = "[Automation's External Key]";

try {
    $authStub = new ET_Client();
    $props = array(
        'ObjectID'  => OBJECT_ID
    );
    $response = new ET_Perform($authStub, OBJ_TYPE, ACTION_TYPE, $props);
    var_dump($response);

} catch (Exception $ex) {
    echo 'Caught exception: ',  $ex->getMessage(), "\n";
}

Result

object(ET_Perform)#5 (6) {
  ["status"]=>
  bool(false)
  ["code"]=>
  int(200)
  ["message"]=>
  NULL
  ["results"]=>
  array(1) {
    [0]=>
    object(stdClass)#8 (3) {
      ["StatusCode"]=>
      string(5) "Error"
      ["StatusMessage"]=>
      string(70) "Automation cannot be Performed. Automation has been marked as deleted."
      ["ErrorCode"]=>
      int(355004)
    }
  }
  ["request_id"]=>
  NULL
  ["moreResults"]=>
  NULL
}

Please advise me how to perform this automation?

  • Are you sure that the Automation exists? Judging from the error, it appears that it has been deleted. – Eliot Harper Apr 18 '17 at 1:38
  • >Are you sure that the Automation exists? Yes, already exists. Not delete. – Akinobu Yamamoto Apr 18 '17 at 1:45
2

I modified PHP sample code after confirm this page named starting-an-automation

PHP Code

require('../ET_Client.php');

const OBJ_TYPE        = "Automation";
const ACTION_TYPE     = "start";
const AUTOMATION_NAME = "[Automation name]";

try {
    $authStub = new ET_Client();

    // Get ObjectID
    $props = array(
        'ProgramID',
        'Name'
    );
    $filter = array(
        'Property' => 'Name',
        'SimpleOperator' => 'equals',
        'Value' => AUTOMATION_NAME
    );
    $automationInfo = new ET_Get($authStub, OBJ_TYPE, $props, $filter);
    var_dump($automationInfo);
    $objectID = $automationInfo->results[0]->ObjectID;

    // Perform automation immediately
    $props = array(
        'ObjectID' => $objectID
    );
    $response = new ET_Perform($authStub, OBJ_TYPE, ACTION_TYPE, $props);
    var_dump($response);

} catch (Exception $ex) {
    echo 'Caught exception: ',  $ex->getMessage(), "\n";
}

Result

object(ET_Get)#5 (6) {
  ["status"]=>
  bool(true)
  ["code"]=>
  int(200)
  ["message"]=>
  NULL
  ["results"]=>
  array(1) {
    [0]=>
    object(stdClass)#12 (3) {
      ["PartnerKey"]=>
      NULL
      ["ObjectID"]=>
      string(36) "**[This is ObjectID]**"
      ["Name"]=>
      string(13) "STG_WEBYOYAKU"
    }
  }
  ["request_id"]=>
  string(36) "[request id]"
  ["moreResults"]=>
  bool(false)
}
object(ET_Perform)#8 (6) {
  ["status"]=>
  bool(true)
  ["code"]=>
  int(200)
  ["message"]=>
  NULL
  ["results"]=>
  array(1) {
    [0]=>
    object(stdClass)#10 (1) {
      ["StatusCode"]=>
      string(2) "OK"
    }
  }
  ["request_id"]=>
  NULL
  ["moreResults"]=>
  NULL
}

So, I can perform automation immediately by PHP via soap-api successfully.

  • Like I said, you just needed to get the objectID :-) – Eliot Harper Apr 18 '17 at 7:47
1

OBJECT_ID is not the Automation's External Key. You will need to retrieve the ObjectID for the Automation before you can run an Automation.

If you are programatically starting a specific Automation (or Automations) on a recurring basis, then you will only need to retrieve the ObjectID once as it won't change.

I've documented how to retrieve an ObjectID for an Automation using the SOAP API here. Assuming that the automation won't change, you can simply use a curl command to retrieve the ObjectID using the instructions that I've documented in the provided link.

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.