-
Notifications
You must be signed in to change notification settings - Fork 253
Data preparation before assigning attribute to an attribute set [Web API Tutorial]
Endpoint
GET http://<host>/rest/all/V1/products/attribute-sets/groups/list?searchCriteria[filterGroups][0][filters][0][field]=attribute_set_id&searchCriteria[filterGroups][0][filters][0][value]=9&searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[filterGroups][0][filters][1][field]=attribute_group_name&searchCriteria[filterGroups][0][filters][1][value]=Product Details&searchCriteria[filterGroups][0][filters][1][conditionType]=eq&searchCriteria[pageSize]=1&searchCriteria[currentPage]=1
Here is how the request looks like in Postman

Response
Magento returns the item with attribute_group_id by given attribute_group_name and attribute_set_id
Complete cURL request
curl -X GET "$endpoint/all/V1/products/attribute-sets/groups/list?searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bfield%5D=attribute_set_id&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bvalue%5D=9&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5BconditionType%5D=eq&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B1%5D%5Bfield%5D=attribute_group_name&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B1%5D%5Bvalue%5D=Product%20Details&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B1%5D%5BconditionType%5D=eq&searchCriteria%5BpageSize%5D=50&searchCriteria%5BcurrentPage%5D=1" -H "accept: application/json" -H "Authorization: Bearer $admin_token" | json_ppWhile this value doesn't make any difference for Web API agents it may impact on the user interface for admin user. In this tutorial, we will show you how to place the input for the attribute selection in the right place.
We want to specify the Size right after the Price. To find the correct sortOrder we will execute 2 queries to the database The first one, will expose the attribute_id for the price attribute:
mysql -uroot -p -e'SELECT attribute_id FROM msi.eav_attribute WHERE attribute_code="price"'The result:
+--------------+
| attribute_id |
+--------------+
| 77 |
+--------------+
The second one, will give us will expose the sortOrder for price attribute:
mysql -uroot -p -e'SELECT sort_order FROM msi.eav_entity_attribute WHERE attribute_id=77 && attribute_set_id = 9'The result:
+------------+
| sort_order |
+------------+
| 30 |
+------------+
Multi-Source Inventory developed by Magento 2 Community
- Technical Vision. Catalog Inventory
- Installation Guide
- List of Inventory APIs and their legacy analogs
- MSI Roadmap
- Known Issues in Order Lifecycle
- MSI User Guide
- 2.3 LIVE User Guide
- MSI Release Notes and Installation
- Overview
- Get Started with MSI
- MSI features and processes
- Global and Product Settings
- Configure Source Selection Algorithm
- Create Sources
- Create Stock
- Assign Inventory and Product Notifications
- Configure MSI backorders
- MSI Import and Export Product Data
- Mass Action Tool
- Shipment and Order Management
- CLI reference
- Reports and MSI
- MSI FAQs
- DevDocs Documentation
- Manage Inventory Management Modules (install/upgrade info)
- Inventory Management
- Reservations
- Inventory CLI reference
- Inventory API reference
- Inventory In-Store Pickup API reference
- Order Processing with Inventory Management
- Managing sources
- Managing stocks
- Link and unlink stocks and sources
- Manage source items
- Perform bulk actions
- Manage Low-Quantity Notifications
- Check salable quantities
- Manage source selection algorithms
- User Stories
- Support of Store Pickup for MSI
- Product list assignment per Source
- Source assignment per Product
- Stocks to Sales Channel Mapping
- Adapt Product Import/Export to support multi Sourcing
- Introduce SourceCode attribute for Source and SourceItem entities
- Assign Source Selector for Processing of Returns Credit Memo
- User Scenarios:
- Technical Designs:
- Module Structure in MSI
- When should an interface go into the Model directory and when should it go in the Api directory?
- Source and Stock Item configuration Design and DB structure
- Stock and Source Configuration design
- Open Technical Questions
- Inconsistent saving of Stock Data
- Source API
- Source WebAPI
- Sources to Sales Channels mapping
- Service Contracts MSI
- Salable Quantity Calculation and Mechanism of Reservations
- StockItem indexation
- Web API and How To cover them with Functional Testing
- Source Selection Algorithms
- Validation of Domain Entities
- PHP 7 Syntax usage for Magento contribution
- The first step towards pre generated IDs. And how this will improve your Integration tests
- The Concept of Default Source and Domain Driven Design
- Extension Point of Product Import/Export
- Source Selection Algorithm
- SourceItem Entity Extension
- Design Document for changing SerializerInterface
- Stock Management for Order Cancelation
- Admin UI
- MFTF Extension Tests
- Weekly MSI Demos
- Tutorials