Black
Black

Reputation: 20342

Magento 2 - Where to find the complete REST API documentation

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?

Upvotes: 0

Views: 542

Answers (1)

0stone0
0stone0

Reputation: 44172

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.

Upvotes: 2

Related Questions