public function create_credential_legacy($recipient_name, $recipient_email, $achievement_name, $issued_on = null, $expired_on = null, $course_name = null, $course_description = null, $course_link = null, $custom_attributes = null){

        $data = array(
            "credential" => array(
                "group_name" => $achievement_name,
                "recipient" => array(
                    "name" => $recipient_name,
                    "email" => $recipient_email
                ),
                "issued_on" => $issued_on,
                "expired_on" => $expired_on,
                "custom_attributes" => $custom_attributes,
                "name" => $course_name,
                "description" => $course_description,
                "course_link" => $course_link
            )
        );

        $client = new \GuzzleHttp\Client();

        $params = array('Authorization' => 'Token token="'.$this->getAPIKey().'"');

        $response = $client->post($this->api_endpoint.'credentials', array(
            'headers' => $params,
            'json' => $data
        ));

        $result = json_decode($response->getBody());

        return $result;
    }
public function create_credential_legacy($recipient_name, $recipient_email, $achievement_name, $issued_on = null, $expired_on = null, $course_name = null, $course_description = null, $course_link = null, $custom_attributes = null){

        $data = array(
            "credential" => array(
                "group_name" => $achievement_name,
                "recipient" => array(
                    "name" => $recipient_name,
                    "email" => $recipient_email
                ),
                "issued_on" => $issued_on,
                "expired_on" => $expired_on,
                "custom_attributes" => $custom_attributes,
                "name" => $course_name,
                "description" => $course_description,
                "course_link" => $course_link
            )
        );

        $client = new \GuzzleHttp\Client();

        $params = array('Authorization' => 'Token token="'.$this->getAPIKey().'"');

        $response = $client->post($this->api_endpoint.'credentials', array(
            'headers' => $params,
            'json' => $data
        ));

        $result = json_decode($response->getBody());

        return $result;
    }
public function create_credential_legacy ( $ recipient_name , $ recipient_email , $ achievement_name , $ issued_on = null , $ expired_on = null , $ course_name = null , $ course_description = null , $ course_link = null , $ custom_attributes = null ) { $ data = array ( "credential" => array ( "group_name" => $ achievement_name , "recipient" => array ( "name" => $ recipient_name , "email" => $ recipient_email ) , "issued_on" => $ issued_on , "expired_on" => $ expired_on , "custom_attributes" => $ custom_attributes , "name" => $ course_name , "description" => $ course_description , "course_link" => $ course_link ) ) ; $ client = new \ GuzzleHttp \ Client ( ) ; $ params = array ( 'Authorization' => 'Token token="' . $ this -> getAPIKey ( ) . '"' ) ; $ response = $ client -> post ( $ this -> api_endpoint . 'credentials' , array ( 'headers' => $ params , 'json' => $ data ) ) ; $ result = json_decode ( $ response -> getBody ( ) ) ; return $ result ; }
Creates a Credential given an existing Group. This legacy method uses achievement names rather than group IDs.
@param String $recipient_name
@param String $recipient_email
@param String $achievement_name
@param Date|null $issued_on
@param Date|null $expired_on
@param stdObject|null $custom_attributes
@return stdObject
Creates a Credential given an existing Group . This legacy method uses achievement names rather than group IDs .