Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to the REST API #4350

Closed
mackelito opened this issue Apr 29, 2016 · 11 comments
Closed

Improvements to the REST API #4350

mackelito opened this issue Apr 29, 2016 · 11 comments
Assignees

Comments

@mackelito
Copy link

Steps to reproduce

  • make a request to "rest/V1/categories/3/products"

Expected result

  1. All info for each product

When creating a web using the API this forces me to make multiple requests If I want to show products from category x

Actual result

  1. I get sku, prioity and category_id.. that´s it.

is there some way to get more data for each product like I get if I do "rest/V1//products"?

@pboisvert
Copy link

Mark--can yu examine if this is working as designed and if so this is a feature request vs a bug

@mackelito
Copy link
Author

Not sure if this is the case but it feels like this REST api didn't really have web apps in mind (or any apps used by endusers). For instance when requesting "/V1/products?&searchCriteria[page_size]=5" The items have "custom_attributes".. in there we find data like description and images, are they really considered custom_attributes?

Now I'm pretty new to Magento as a plattform but for me, the logical place to find this data would be someting like product.description and product.image (you get the idea).

Also there are other data that I only get references to.. Let´s say I have a product that comes in 8 different materials.. do I need to make 1 request for each material? Even if it's only 1 extra request to get the attributes it can become a problem.

I know that we can customise the REST API but I think it should be the other way around.. the default should be to get the product data I would expect to find on a product page on a site.. (like in the Luma Theme)

In a backend language I can accept it but to be forced to make extra requests to get data seems weird. :)

@mbrinton01
Copy link

Thank you @mackelito, I have created internal ticket MAGETWO-53521 to track your request.

@mackelito
Copy link
Author

Awesome!
Let me know if I can help out somehow!..

BTW.. can I track the ticket somewhere?

@mbrinton01
Copy link

@mackelito we don't have a way for external users to view our internal issues in JIRA, but I will comment here if we have more questions in the future.

@skovalenk
Copy link
Contributor

Hi. You can do this in way represented in devdocs: http://devdocs.magento.com/guides/v2.0/get-started/product-categry-filter.html

@slavvka slavvka closed this as completed Jul 27, 2016
@mackelito
Copy link
Author

I did figure out how to do it with searchCriteria params, sorry to not getting back on this ticket sooner..

So in other words.. it works fine :)

@mackelito
Copy link
Author

Sorry for reposting in this closed ticket.. but I realised I still do have some questions.

If I make a request to "V1/guest-carts/666ef786077b70c95016727cfaf21830/items" I get a response with the items in that cart.

[{'' "item_id": 122, "sku": "MH01-XS-Black", "qty": 2, "name": "Chaz Kangeroo Hoodie-XS-Black", "price": 52, "product_type": "simple", "quote_id": "75fc406b9aadbad6fe1b9a2df9881acd" }, { "item_id": 123, "sku": "24-MB04", "qty": 2, "name": "Strive Shoulder Pack", "price": 32, "product_type": "simple", "quote_id": "75fc406b9aadbad6fe1b9a2df9881acd" }]

Does that mean that in order to get product image for each item I need to do another request?

Maybe It´s just that I don´t fully understand how to use the rest api.. is there any other (more extensive) docs?

@mackelito
Copy link
Author

@sereban or @slavvka perhaps someone of you can explain to me how to get product images when requesting the cart? ("V1/guest-carts/666ef786077b70c95016727cfaf21830/items" or "V1/guest-carts/666ef786077b70c95016727cfaf21830/totals").

(Obviously we do not want to do api requests to each product just to get the urls for the images)

@mackelito
Copy link
Author

Please reopen this ticket

@skovalenk
Copy link
Contributor

Hi. @mackelito about getting product images:
See \Magento\Quote\Api\Data\CartItemInterface in order to see what data can retrieved. As i see extension attributes are empty, so thats all data you can get.
In order to get product images you need to add them to extension_attributes
See this guide for extension attributes:
http://devdocs.magento.com/guides/v2.1/extension-dev-guide/attributes.html

taskula pushed a commit to Hypernova-Oy/magento2 that referenced this issue Jun 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants