Chapter 19. Random objects

Random object functionality is provided by the bundled UNLVRandom module. The random object can be returned using the PHP and HTTP APIs.

To access it using the PHP API, use the DMObject::getRandom() method, which returns an object of type DMObject:

$obj = UNLVRandomObject::getRandomObject();
echo $obj->getField("title");

To access the random object using the HTTP API, navigate to http://my_cdm_server/dm/api/objects/random. JSON is available by appending .json to the URI. HTTP clients that request JSON as a preferred content type in their HTTP Accept header should receive it automatically.