英文:
Magento 2 - Where to find the complete REST API documentation
问题
似乎官方Magento 2 REST API文档不完整。
我在我们以前的同事的应用程序中找到了这段代码:
protected function addItemToCart($cartId, $cartItem)
{
return $this->client->request('POST', "carts/{$cartId}/items", [
'json' => [
'cartItem' => $cartItem,
],
]);
}
但我找不到关于 carts/{$cartId}/items
的任何文档。
我找到的最接近的是:/V1/guest-carts/{cartId}/items
我在哪里可以找到关于 carts/{$cartId}/items
的文档?
英文:
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
?
答案1
得分: 1
carts/{$cartId}/items
路由上没有可用的 POST 方法。
所以可能有其他情况,可能是以下之一:
- 实际上,您正在使用
POST /V1/carts/{quoteId}/items
- 您的前同事扩展了默认 API,所以
carts/{$cartId}/items
上的 POST 是一个自定义端点 - 您正在使用一个非常旧的 Magento 版本,其中这是可用的。
考虑使用 ReDoc 文档 页面。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论