2

I am accessing database using simple http request and use it on another interface.for example api's for Andriod or iphone .Even simple http request and method created in mage functionality without using any api its running perfectly.

Then Why there is any need of api's , rest or soap ? Below code is used to load magento site cart through android app .No api is used in this.

<?php

require_once 'app/Mage.php';
Mage::setIsDeveloperMode(true);
$websiteId = Mage::app()->getWebsite()->getId();
$storeId = Mage::app()->getStore()->getStoreId();
$currencySymbol = '£';
$method = isset($_REQUEST['method']) ? $_REQUEST['method'] : "";
switch ($method) {
    case 'LoadCart': http://mysiteurl/T4T-mage-api.php?method=LoadCart&cart_id=2//loading time= 506 msif($_REQUEST['cart_id']) 
        {
            $session = Mage::getSingleton("core/session", array("name" => "frontend"));
            $quote = Mage::getModel('sales/quote')->load($_REQUEST['cart_id']);
            $quote->setIsActive(true);
            $quote->save();
            Mage::getSingleton('checkout/session')->replaceQuote($quote);
            header('location:/checkout/cart/');
        }
        break;
    default :echo 'This is Not a Valid Method.';
}?>
6
  • Hi @Anil Thakur, how you're making calls for mobile app using http request ? Jul 27, 2018 at 7:18
  • creating a url and getting input from android user and use it over internet by hitting from mobile app and then accessing in database by code used in our file .In this file no such kind of coding used like api or curl. Jul 27, 2018 at 8:10
  • and do you use Oauth for the same ? Authentication token ? Jul 27, 2018 at 8:24
  • Din't use any code of api's . Actually this is my doubt . How i can accessing this without api coding Jul 27, 2018 at 8:30
  • Actually it is essential. Jul 27, 2018 at 9:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.