/** * @depends testAccountCreationAndDeletion * */ public function testModifyAccount() { $request = new PrintNode\Request($this->credentials); $response = $request->post($this->account); $request->setChildAccountById($response->GetDecodedContent()["Account"]["id"]); $account = new PrintNode\Account(); $account->Account = array("firstname" => "ANewFirstName", "lastname" => "ALastName", "email" => "*****@*****.**", "password" => "APassword"); $response = $request->patch($account); $this->assertEquals("ANewFirstName", $response->GetDecodedContent()["firstname"]); $request->DeleteAccount(); }
* you must be use the Parent Account API Key. * * For this example, you must be authenticated as the Parent Account. **/ $credentials->setApiKey(PRINTNODE_APIKEY); $request = new PrintNode\Request($credentials); /** * You can specify the Child Account to manipulate using any of these methods: * * - PrintNode\Request->setChildAccountById($id) * - PrintNode\Request->setChildAccountByEmail($email) * - PrintNode\Request->setChildAccountByCreatorRef($creatorRef) * * We will set the Child Account by ID **/ $request->setChildAccountById($id); // All requests from this request object will now operate on this Child Account. $whoami = $request->getWhoami(); $computers = $request->getComputers(); $printers = $request->getPrinters(); /** * We have authenticated using the Parent Account API Key and can therefore * edit Child Acccount details: **/ $account = new PrintNode\Account(); // Let's change the Child Account name. $account->Account = array("firstname" => "ANewFirstName", "lastname" => "ANewLastName"); $request->patch($account); $whoamiNow = $request->getWhoami(); // Let's delete our Child Account. $request->deleteAccount();