-
Notifications
You must be signed in to change notification settings - Fork 4
Creating and Listing assets
Luís Mendes edited this page Nov 19, 2015
·
3 revisions
<?php
require 'vendor/autoload.php';
use Passworks\Client;
// Instantiate the Passworks client
$api = new Passworks\Client('your api username', 'your api key');
// upload a asset (background image)
$api->createAsset('background', '/local-path-to-a-image/image.png');
// fetch a list of all assets
$assets = $api->getAssets();
// iterate through the list of assets
foreach($assets as $asset){
print_r($asset);
}
// return the assets as an array
print_r($api->getAssets()->toArray());
// upload a 'background' type asset
$asset = $api->createAsset('background', '/servers/sites/backend-saas/public/uploads/asset/368/original.png');
print_r($asset);
// get a specific asset (in this case the previously created asset)
$asset = $api->getAsset('51838f55-8d40-4554-be22-03ae685a0a32');
print_r($asset);
?>