oont-contents/plugins/xc-woo-google-cloud-print/vendor/printnode/printnode-php/examples/example-2-creating-a-child-account.php
2025-02-08 15:10:23 +01:00

30 lines
777 B
PHP

<?php
include 'vendor/autoload.php';
/**
* To create Child Accounts you need a PrintNode Integrator Account.
* You then need to authenticate with your API Key.
**/
$credentials = new PrintNode\Credentials();
$credentials->setApiKey(PRINTNODE_APIKEY);
$request = new PrintNode\Request($credentials);
// Initialise a Child Account
$account = new PrintNode\Account();
// Set properties on the Child Account
$account->Account = array(
"firstname" => "A",
"lastname" => "ALastName",
"password" => "superStrongPassword",
"email" => "email@example.com"
);
// Post the Child Account to the API
$aNewAccount = $request->post($account);
// You can get the Child Account ID from the response object
$id = $aNewAccount->GetDecodedContent()["Account"]["id"];
?>