2

Here's the url

http://<magento host>/rest/default/V1/carts/mine/items

Method POST

Headers

Authentication :: Bearer <customer token>
Content-Type :: application/json

Body json data

{
 "cartItem": {
 "sku": "HKrh15hc",
 "qty": 1,
 "quote_id": "23",
 "product_option": {
 "extension_attributes": {
 "configurable_item_options": [
 {
 "option_id": "93",
 "option_value": 50
 },
 {
 "option_id": "141",
 "option_value": 169
 }
 ]
 }
 },
 "extension_attributes": {}
 }
}

I have cross checked the attributes and options value id and also a Quote id

Response

{ "message": "Could not save quote", "trace": "#0 /var/www/html/rb-dev/vendor/magento/module-quote/Model/QuoteRepository/SaveHandler.php(82): Magento\Quote\Model\Quote\Item\CartItemPersister->save(Object(Magento\Quote\Model\Quote\Interceptor), Object(Magento\Quote\Model\Quote\Item))\n#1 /var/www/html/rb-dev/generated/code/Magento/Quote/Model/QuoteRepository/SaveHandler/Interceptor.php(24): Magento\Quote\Model\QuoteRepository\SaveHandler->save(Object(Magento\Quote\Model\Quote\Interceptor))\n#2 /var/www/html/rb-dev/vendor/magento/module-quote/Model/QuoteRepository.php(181): Magento\Quote\Model\QuoteRepository\SaveHandler\Interceptor->save(Object(Magento\Quote\Model\Quote\Interceptor))\n#3 /var/www/html/rb-dev/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Quote\Model\QuoteRepository->save(Object(Magento\Quote\Model\Quote\Interceptor))\n#4 /var/www/html/rb-dev/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Quote\Model\QuoteRepository\Interceptor->___callParent('save', Array)\n#5 /var/www/html/rb-dev/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Quote\Model\QuoteRepository\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Quote\Model\Quote\Interceptor))\n#6 /var/www/html/rb-dev/generated/code/Magento/Quote/Model/QuoteRepository/Interceptor.php(78): Magento\Quote\Model\QuoteRepository\Interceptor->___callPlugins('save', Array, Array)\n#7 /var/www/html/rb-dev/vendor/magento/module-quote/Model/Quote/Item/Repository.php(92): Magento\Quote\Model\QuoteRepository\Interceptor->save(Object(Magento\Quote\Model\Quote\Interceptor))\n#8 [internal function]: Magento\Quote\Model\Quote\Item\Repository->save(Object(Magento\Quote\Model\Quote\Item))\n#9 /var/www/html/rb-dev/vendor/magento/module-webapi/Controller/Rest.php(330): call_user_func_array(Array, Array)\n#10 /var/www/html/rb-dev/vendor/magento/module-webapi/Controller/Rest.php(239): Magento\Webapi\Controller\Rest->processApiRequest()\n#11 /var/www/html/rb-dev/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))\n#12 /var/www/html/rb-dev/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)\n#13 /var/www/html/rb-dev/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#14 /var/www/html/rb-dev/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(39): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)\n#15 /var/www/html/rb-dev/vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#16 /var/www/html/rb-dev/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()\n#17 /var/www/html/rb-dev/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()\n#18 /var/www/html/rb-dev/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#19 {main}" }

asked Sep 8, 2018 at 6:20

1 Answer 1

2

Use below collection which have create cart , Add simple and configurable product into the cart API which worked for me.

https://www.getpostman.com/collections/a7900127aac366535a20

answered Oct 5, 2018 at 17:03
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.