public function create($username, $password, $alias, $appId = null)
    {
        $mandatoryArgs = [
            'username' => $username,
            'password' => $password,
            'alias' => $alias
        ];

        if (ArrayOperations::checkNull($mandatoryArgs)) {
            throw new PlivoValidationException(
                "Mandatory parameters cannot be null");
        }

        $response = $this->client->update(
            $this->uri,
            array_merge($mandatoryArgs, ['app_id' => $appId])
        );
        $responseContents = $response->getContent();
        if(!array_key_exists("error",$responseContents)){

            return new EndpointCreateReponse(
                $responseContents['username'],
                $responseContents['alias'],
                $responseContents['message'],
                $responseContents['endpoint_id'],
                $responseContents['api_id'],
                $response->getStatusCode()
            );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }
    }
public function create($username, $password, $alias, $appId = null)
    {
        $mandatoryArgs = [
            'username' => $username,
            'password' => $password,
            'alias' => $alias
        ];

        if (ArrayOperations::checkNull($mandatoryArgs)) {
            throw new PlivoValidationException(
                "Mandatory parameters cannot be null");
        }

        $response = $this->client->update(
            $this->uri,
            array_merge($mandatoryArgs, ['app_id' => $appId])
        );
        $responseContents = $response->getContent();
        if(!array_key_exists("error",$responseContents)){

            return new EndpointCreateReponse(
                $responseContents['username'],
                $responseContents['alias'],
                $responseContents['message'],
                $responseContents['endpoint_id'],
                $responseContents['api_id'],
                $response->getStatusCode()
            );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }
    }
public function create ( $ username , $ password , $ alias , $ appId = null ) { $ mandatoryArgs = [ 'username' => $ username , 'password' => $ password , 'alias' => $ alias ] ; if ( ArrayOperations :: checkNull ( $ mandatoryArgs ) ) { throw new PlivoValidationException ( "Mandatory parameters cannot be null" ) ; } $ response = $ this -> client -> update ( $ this -> uri , array_merge ( $ mandatoryArgs , [ 'app_id' => $ appId ] ) ) ; $ responseContents = $ response -> getContent ( ) ; if ( ! array_key_exists ( "error" , $ responseContents ) ) { return new EndpointCreateReponse ( $ responseContents [ 'username' ] , $ responseContents [ 'alias' ] , $ responseContents [ 'message' ] , $ responseContents [ 'endpoint_id' ] , $ responseContents [ 'api_id' ] , $ response -> getStatusCode ( ) ) ; } else { throw new PlivoResponseException ( $ responseContents [ 'error' ] , 0 , null , $ response -> getContent ( ) , $ response -> getStatusCode ( ) ) ; } }
This method lets you create a new endpoint on Plivo
@param string $username
@param string $password
@param string $alias
@param null|string $appId
@return JSON output
@throws PlivoValidationException
This method lets you create a new endpoint on Plivo