I would like to implement am Magento 2 REST api i.e

if the customer login then we have to merge the guest items to customer quote.

As per the requirement i found one file in the respected path i.e


public function loadCustomerQuote()
        if (!$this->_customerSession->getCustomerId()) {
            return $this;

        $this->_eventManager->dispatch('load_customer_quote_before', ['checkout_session' => $this]);

        try {
            $customerQuote = $this->quoteRepository->getForCustomer($this->_customerSession->getCustomerId());
        } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
            $customerQuote = $this->quoteFactory->create();

        if ($customerQuote->getId() && $this->getQuoteId() != $customerQuote->getId()) {
            if ($this->getQuoteId()) {


            if ($this->_quote) {
            $this->_quote = $customerQuote;
        } else {
        return $this;

how do we implement this functionality in magento 2 REST api.

1) Is it possible to implement?

2) if it is possible, how to check with the postman?

3) is it possible to consider the session concept in REST apis?

Please suggest me and help me.


  • Hello @Nagaraju Kasa, have you find any solution regarding this ? Jul 26, 2018 at 11:50

1 Answer 1


Magento 2 REST can not distinguish between authenticated and anonymous customers. Web services ACL is applied for admin users only. All customers are anonymous for REST services.

You can create such REST service if you want but you need to authenticate customers by yourself (using \Magento\Customer\Model\Session, for example). Of course, REST requests should contain PHPSESSID cookie for appropriate session in HTTP headers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.