Based on the answer provided in this post - my actual code follows -,

$myClient = new ET_Client(true, true);
$authStub = $myClient;
$url = "https://www.exacttargetapis.com/address/v1/validateEmail";
$props = array("email" => $EmailAddress, "validators" => array("SyntaxValidator", "MXValidator", "ListDetectiveValidator"));

$return = new ET_PostRest($authStub, $url, $props);


I am getting the following response

   'status' => false,
   'code' => 401,
   'message' => NULL,
   'results' => 
     'documentation' => 'https://code.docs.exacttarget.com/rest/errors/403',
     'errorcode' => 0,
     'message' => 'Not Authorized',
   'request_id' => NULL,
   'moreResults' => NULL,

SOAP based calls are working fine, so I must be missing something with the REST Auth.

2 Answers 2


ET_PostRest is after the point in the process where the access_token is applied to the request so it would need to be applied manually.

Where is current says: $url = "https://www.exacttargetapis.com/address/v1/validateEmail";

Replace it with: $url = "https://www.exacttargetapis.com/address/v1/validateEmail?access_token=".$authStub->getAuthToken();

  • I guess that means the SDK doesn't handle REST token management then yet? I thought since i was setting up a new ET_Client and passing $authStub it would be taken care of. I didn't see it applied in the class anywhere but I also don't know what the ?legacy=1 that does get added does.
    – James
    Commented Mar 12, 2014 at 12:11
  • oops, wasn't reading your post correctly and didn't realize the authToken was coming from $authStub
    – James
    Commented Mar 12, 2014 at 12:16
  • if i make the request too often (less than 5 minutes) then i get Fatal error: Uncaught exception 'Exception' with message 'Unable to validate App Keys(ClientID/ClientSecret) provided.: Unable to validate App Keys(ClientID/ClientSecret) provided, requestToken response:{"additionalErrors":null,"documentation":"http:\/\/jssvc-s1.xt.local:80\/AuthService\/v1\/requestToken?legacy=1","errorcode":1,"field":null,"fieldErrors":null,"message":"Unauthorized","objectErrors":null,"path":null,"validationErrors":null}' in /ET_Client.php on line 107
    – James
    Commented Mar 12, 2014 at 12:27
  • i realize this is still under development and i built my own class before i knew this existed, but I'd still like to understand the SDK for REST as much as possible
    – James
    Commented Mar 12, 2014 at 12:30

Why not just improving the Class ET_PostRest? (that does actually ignore the param authStub... why?)

class ET_PostRest extends ET_Constructor {
    function __construct(ET_Client $authStub, $url, $props) {

        $query = parse_url($url, PHP_URL_QUERY);

        $url .= !empty($query)?'&':'?';
        $url .= 'access_token='.$authStub->getAuthToken();

        $restResponse = restPost($url, json_encode($props));            
        parent::__construct($restResponse->body, $restResponse->httpcode, true);                            

.... Usage:

 $myclient = new ET_Client();
 $props = array("email" => $email, "validators" => array("SyntaxValidator", "MXValidator", "ListDetectiveValidator"));

 $return = new ET_PostRest($myclient, $url, $props);


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .