Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

best approach to list rooms of specific template type?

Avatar

Level 2

hi, i want to get a list rooms only within a specific template.  I'm curious if i should use the PHP scripts or actionscript. 

In considering actionscript, i've heard it may not be as safe since the .swf could potentially be decompiled and account credentials found out.  in considering PHP, it would "cost" more time since an HTTPService call would be required as well the user needing to wait for the server to login the account (however, this currently the approach i'm leaning towards since I'm writing to a DB on room creation anyway)

what would be the best practice to get a list of rooms WITHIN A SPECIFIC TEMPLATE?  If the answer is PHP, could someone provide an example of how to parse the returned array to get only a specific template type?  I'm a little confused on how to access specific nodes of ...$list = $am->listRooms();... Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Employee

This is an example of using AFCSAccount->listRoom() :

$am = new AFCSAccount($accountURL);

$am->login($username, $password);

echo "==== room list for {$accountName} ====\n";

foreach ($am->listRooms() as $r) {

echo "{$r->name}:{$r->desc}:{$r->created->format(DATE_RFC822)}\n";

}

You would need to look at all rooms where $r->desc == "template name". Currently we don't provide a filter for this but I understand how this would be useful.

The alternative is that since you are maintaining a database and use it for room creation, you should store the template information there for quick retrieval. Again, the way we store room informations is designed for fast access to specific rooms, but not for querying possibly long list of rooms.

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

This is an example of using AFCSAccount->listRoom() :

$am = new AFCSAccount($accountURL);

$am->login($username, $password);

echo "==== room list for {$accountName} ====\n";

foreach ($am->listRooms() as $r) {

echo "{$r->name}:{$r->desc}:{$r->created->format(DATE_RFC822)}\n";

}

You would need to look at all rooms where $r->desc == "template name". Currently we don't provide a filter for this but I understand how this would be useful.

The alternative is that since you are maintaining a database and use it for room creation, you should store the template information there for quick retrieval. Again, the way we store room informations is designed for fast access to specific rooms, but not for querying possibly long list of rooms.