Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 173db13

Browse files
authored
Merge pull request #8508 from ajithkumar-maragathavel/rest-api-product-creation
Updated the response for api endpoints & added additional info
2 parents bd06b3e + 3169346 commit 173db13

File tree

2 files changed

+94
-4
lines changed

2 files changed

+94
-4
lines changed

src/guides/v2.3/rest/tutorials/configurable-product/create-configurable-product.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ The sample payload does not contain the price or the size. These attributes will
1919

2020
The `visibility` attribute is set to 4, meaning the product can be found by browsing or searching. This value will be changed for the simple products.
2121

22+
The below table shows the equivalent code for the visibility attribute
23+
24+
Visibility | Code
25+
--- | ---
26+
`Not Visible Individually` | 1
27+
`Catalog` | 2
28+
`Search` | 3
29+
`Catalog, Search` | 4
30+
2231
{:.bs-callout-info}
2332
Before you using this code sample, verify that the attribute values are the same in your installation. See [Get the list of attributes defined in an attribute searchCriteria]({{ page.baseurl }}/rest/tutorials/configurable-product/plan-product.html#get-attributes) for more information.
2433

src/guides/v2.3/rest/tutorials/configurable-product/plan-product.md

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,19 @@ We'll make several calls to find the values needed to create the product
5353

5454
The sample data provides multiple attribute sets, including Default, Top, and Bottom. To assign the Top attribute set to the product, we need to know the corresponding `attribute_set_id`.
5555

56-
Use the following call to search for the attribute set named `Top`.
56+
Use the following call to search for the attribute set named `Top` and `entity_type_id` equals to `4`.
57+
By default, the `catalog_product` entity has the `entity_type_id` value as `4`.
5758

5859
**Endpoint:**
5960

6061
```html
6162
GET <host>/rest/<store_code>/V1/eav/attribute-sets/list?
6263
searchCriteria[filter_groups][0][filters][0][field]=attribute_set_name&
6364
searchCriteria[filter_groups][0][filters][0][value]=Top&
64-
searchCriteria[filter_groups][0][filters][0][condition_type]=eq
65+
searchCriteria[filter_groups][0][filters][0][condition_type]=eq&
66+
searchCriteria[filter_groups][1][filters][0][field]=entity_type_id&
67+
searchCriteria[filter_groups][1][filters][0][value]=4&
68+
searchCriteria[filter_groups][1][filters][0][condition_type]=eq
6569
```
6670

6771
**Response:**
@@ -88,6 +92,15 @@ The `attribute_set_id` for the Top attribute set is `9`.
8892
"condition_type": "eq"
8993
}
9094
]
95+
},
96+
{
97+
"filters": [
98+
{
99+
"field": "entity_type_id",
100+
"value": "4",
101+
"condition_type": "eq"
102+
}
103+
]
91104
}
92105
]
93106
},
@@ -101,11 +114,51 @@ Use the `GET V1/products/attribute-sets/:attributeSetId/attributes` call to retu
101114

102115
**Endpoint:**
103116

104-
`GET <host>/rest/default/V1/products/attribute-sets/9/attributes`
117+
```html
118+
GET <host>/rest/default/V1/products/attribute-sets/9/attributes
119+
```
105120

106121
**Response:**
107122

108-
The response contains almost 3,000 lines. The following table provides a summary of the attributes that are relevant in this tutorial.
123+
```json
124+
[
125+
{
126+
"attribute_id": 141,
127+
"attribute_code": "size",
128+
"frontend_input": "select",
129+
"entity_type_id": "4",
130+
"is_required": false,
131+
"options": [
132+
{
133+
"label": " ",
134+
"value": ""
135+
},
136+
{
137+
"label": "Small",
138+
"value": "168"
139+
},
140+
{
141+
"label": "Medium",
142+
"value": "169"
143+
},
144+
{
145+
"label": "Large",
146+
"value": "170"
147+
}
148+
],
149+
"is_user_defined": true,
150+
"default_frontend_label": "Size",
151+
"frontend_labels": [],
152+
"backend_type": "int",
153+
"source_model": "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",
154+
"default_value": "",
155+
"is_unique": "0",
156+
"validation_rules": []
157+
}
158+
]
159+
```
160+
161+
The response contains almost 3,000 lines and the above is a part of the response from the endpoint. The following table provides a summary of the attributes that are relevant in this tutorial.
109162

110163
Admin label | Selected value | Attribute ID | attribute_code | Attribute value
111164
--- | --- | --- | --- | ---
@@ -125,13 +178,41 @@ You must assign the product to one or more categories to enable customers to fin
125178

126179
Use the following call to search for all categories (`id` is greater than or equal to `0`).
127180

181+
**Endpoint:**
182+
128183
```html
129184
GET <host>/rest/default/V1/categories?
130185
searchCriteria[filter_groups][0][filters][0][field]=id&
131186
searchCriteria[filter_groups][0][filters][0][value]=1&
132187
searchCriteria[filter_groups][0][filters][0][condition_type]=gte
133188
```
134189

190+
**Response:**
191+
192+
```json
193+
{
194+
"id": 2,
195+
"parent_id": 1,
196+
"name": "Default Category",
197+
"is_active": true,
198+
"position": 1,
199+
"level": 1,
200+
"product_count": 0,
201+
"children_data": [
202+
{
203+
"id": 11,
204+
"parent_id": 2,
205+
"name": "Men",
206+
"is_active": true,
207+
"position": 1,
208+
"level": 2,
209+
"product_count": 1,
210+
"children_data": []
211+
}
212+
]
213+
}
214+
```
215+
135216
Note that women's tops and tees have different ids than men's tops and tees. The values for men's clothing are:
136217

137218
* Men - `11`

0 commit comments

Comments
 (0)