Answer the question
In order to leave comments, you need to log in
How to get REST API page information?
Good afternoon, I studied open api , but did not find an answer to the question of how to get information for a page, for example:
There is a category page, for it you need to get:
1. Meta data (description title, h1, etc., etc.)
2. Product list
Worth whether to split it into 2 requests:
meta/:category
products/:category
or make a request like: /shop/:category
and get in response:
{
name: 'My category',
title: 'My category title',
h1: 'H1 category',
...
products: [
... // список продуктов { name: 'name', title: 'title', ... }
],
}
Answer the question
In order to leave comments, you need to log in
In general, in the rest they try to make such endpoints that the application needs on the client side. But, in this case, I would pay attention to the fact that there can be a lot of products in a particular category and you will divide them by 10 / 20 / 50, etc. At the same time, it is more logical to get information about the category itself once. That is, I would divide it into two queries. And it will look much more logical when you need to get only a list of products of a certain category somewhere.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question