samples/PhotoAlbum/lib/rb.php
public function handleRESTGetRequest( $pathToResource ) {
		if (!is_string($pathToResource)) return $this->resp(null,0,-32099,'IR');
		$resourceInfo = explode('/',$pathToResource);
		$type = $resourceInfo[0];
		try {
			if (count($resourceInfo) < 2) {
				return $this->resp(RedBean_Facade::findAndExport($type));
			}
			else {
				$id = (int) $resourceInfo[1];
				return $this->resp(RedBean_Facade::load($type,$id)->export(),$id);
			}
		}
		catch(Exception $e) {
			return $this->resp(null,0,-32099);
		}
	}
public function handleRESTGetRequest( $pathToResource ) {
		if (!is_string($pathToResource)) return $this->resp(null,0,-32099,'IR');
		$resourceInfo = explode('/',$pathToResource);
		$type = $resourceInfo[0];
		try {
			if (count($resourceInfo) < 2) {
				return $this->resp(RedBean_Facade::findAndExport($type));
			}
			else {
				$id = (int) $resourceInfo[1];
				return $this->resp(RedBean_Facade::load($type,$id)->export(),$id);
			}
		}
		catch(Exception $e) {
			return $this->resp(null,0,-32099);
		}
	}
public function handleRESTGetRequest ( $ pathToResource ) { if ( ! is_string ( $ pathToResource ) ) return $ this -> resp ( null , 0 , - 32099 , 'IR' ) ; $ resourceInfo = explode ( '/' , $ pathToResource ) ; $ type = $ resourceInfo [ 0 ] ; try { if ( count ( $ resourceInfo ) < 2 ) { return $ this -> resp ( RedBean_Facade :: findAndExport ( $ type ) ) ; } else { $ id = ( int ) $ resourceInfo [ 1 ] ; return $ this -> resp ( RedBean_Facade :: load ( $ type , $ id ) -> export ( ) , $ id ) ; } } catch ( Exception $ e ) { return $ this -> resp ( null , 0 , - 32099 ) ; } }
Support for RESTFul GET-requests.
Only supports very BASIC REST requests, for more functionality please use
the JSON-RPC 2 interface.

@param string $pathToResource RESTFul path to resource

@return string $json a JSON encoded response ready for sending to client
Support for RESTFul GET - requests . Only supports very BASIC REST requests for more functionality please use the JSON - RPC 2 interface .