0

It seems like the official Magento 2 REST API Documentation is not complete.

I found this code in a application of one of our ex colleagues:

protected function addItemToCart($cartId, $cartItem)
{
    return $this->client->request('POST', "carts/{$cartId}/items", [
        'json' => [
            'cartItem' => $cartItem,
        ],
    ]);
}

But I can't find any documenation for carts/{$cartId}/items.

The nearest I can find is: /V1/guest-carts/{cartId}/items

Where can I find the documentation for carts/{$cartId}/items?

0

1 Answer 1

2

There isn't a POST method available on the carts/{$cartId}/items route.


So there's probably something else going on, could be one of these:

  • Actually you're using POST /V1/carts/{quoteId}/items
  • Your ex-colleagues extended the default API so the POST on carts/{$cartId}/items is a custom endpoint
  • You are using a very old Magento version in which this was available.

Consider using the ReDoc Documentation page.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, I think he was using the route which you have posted. Thx!

Your Answer

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.