public function post($object, $operation, $parameters)
    {
        if (null === $this->apiKey) {
            $this->authenticate();
        }

        $url = sprintf('/api/%s/version/%s/do/%s', $object, $this->version, $operation);
        $parameters = array_merge(
            array(
                'api_key'  => $this->apiKey,
                'user_key' => $this->userKey,
                'format'   => $this->format,
                'output'   => $this->output
            ),
            $parameters
        );

        try {
            return $this->doPost($object, $url, $parameters);
        } catch (AuthenticationErrorException $e) {
            $this->authenticate();
            $parameters['api_key'] = $this->apiKey;

            return $this->doPost($object, $url, $parameters);
        }
    }
public function post($object, $operation, $parameters)
    {
        if (null === $this->apiKey) {
            $this->authenticate();
        }

        $url = sprintf('/api/%s/version/%s/do/%s', $object, $this->version, $operation);
        $parameters = array_merge(
            array(
                'api_key'  => $this->apiKey,
                'user_key' => $this->userKey,
                'format'   => $this->format,
                'output'   => $this->output
            ),
            $parameters
        );

        try {
            return $this->doPost($object, $url, $parameters);
        } catch (AuthenticationErrorException $e) {
            $this->authenticate();
            $parameters['api_key'] = $this->apiKey;

            return $this->doPost($object, $url, $parameters);
        }
    }
public function post ( $ object , $ operation , $ parameters ) { if ( null === $ this -> apiKey ) { $ this -> authenticate ( ) ; } $ url = sprintf ( '/api/%s/version/%s/do/%s' , $ object , $ this -> version , $ operation ) ; $ parameters = array_merge ( array ( 'api_key' => $ this -> apiKey , 'user_key' => $ this -> userKey , 'format' => $ this -> format , 'output' => $ this -> output ) , $ parameters ) ; try { return $ this -> doPost ( $ object , $ url , $ parameters ) ; } catch ( AuthenticationErrorException $ e ) { $ this -> authenticate ( ) ; $ parameters [ 'api_key' ] = $ this -> apiKey ; return $ this -> doPost ( $ object , $ url , $ parameters ) ; } }
Makes necessary preparations for a POST request to the Pardot API,
handles authentication retries

The method constructs a valid url based on the object and the operator.
If the API key is null, it also makes a call to the authenticate method.
If an API key is present but happens to be stale, this is detected as
well and a call to authenticate is made to get a new key.

@param string $object     The name of the Pardot object of interest
@param string $operation  The operation to be performed on the object
@param array  $parameters The parameters to send

@access public

@return mixed            In case of format=JSON it returns PHP arrays, if
format=XML it will either return a single
SimpleXMLElement or an array of SimpleXmlElements

@throws                  HGG\Pardot\RequestException
HGG\Pardot\RuntimeException
Makes necessary preparations for a POST request to the Pardot API handles authentication retries