I want to retrieve the list of items in a customer's shopping cart programmatically through REST API. I have tried this code and other similar ones on stackexchange for which each fail to retrieve the list of items in the customers shopping cart. Access to the REST Service(consumer key and tokens) are valid.
// retrieve quote items collection
$itemsCollection = Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection();
// get array of all items what can be display directly
$itemsVisible = Mage::getSingleton('checkout/session')->getQuote()->getAllVisibleItems();
// retrieve quote items array
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
foreach($items as $item) {
echo 'ID: '.$item->getProductId().'<br />';
echo 'Name: '.$item->getName().'<br />';
echo 'Sku: '.$item->getSku().'<br />';
echo 'Quantity: '.$item->getQty().'<br />';
echo 'Price: '.$item->getPrice().'<br />';
echo "<br />";
}