You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: changelog.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@
12
12
* (Developer) Implemented _IWidgetProvider_. Allows request scoped registration of action routes to be injectable into widget zones. Perfect for custom action filters.
13
13
* (Developer) Simple widgets: the model of the parent action view context now gets passed to a widget.
14
14
* (Developer) New IoC method ContainerManager.InjectProperties()
15
+
*#393 Web API: Implement OData actions for simpler working with product attributes
#### Getting a product with name *SmartStore eBay SmartSeller*
384
+
385
+
GET http://localhost:1260/odata/v1/Products?$top=1&$filter=Name eq 'SmartStore eBay SmartSeller'
386
+
387
+
#### Get child products of group product with ID 210
388
+
389
+
GET http://localhost:1260/odata/v1/Products?$top=120&$filter=ParentGroupedProductId eq 210
390
+
391
+
#### Get final price of product with ID 211
392
+
393
+
POST http://localhost:1260/odata/v1/Products(211)/FinalPrice
394
+
395
+
Note the post method. There is a second action `LowestPrice` which serves the lowest possible price for a product.
396
+
397
+
#### Managing product attributes
398
+
399
+
You can use the following endpoints: `ProductAttributes` (types of attributes), `ProductVariantAttributes` (attribute types mapped to a product), `ProductVariantAttributeValues` (attribute values assigned to product) and optionally `ProductVariantAttributeCombinations` (additional information for particular attribute combinations). Because managing attributes that way can lead to some extra work, there is an action method `ManageAttributes` that wraps up the most important steps.
400
+
401
+
POST http://localhost:1260/odata/v1/Products(211)/ManageAttributes
That request configurates a product with the ID 211 with two attributes `Color` and `Size` and its values `Red, Green, Blue` and `Large, X-Large`. The action parameter `Attributes` is of type `ManageAttributeType`. See the OData metadata document for a complete list of available properties. If `Synchronize` is set to `false` only missing attributes and attribute values are inserted. If set to `true` existing records are also updated and values that are not included in the request body are removed from the database. If you pass an empty value array the attribute and all its values are removed from the product.
412
+
413
+
The following method creates all possible attribute combinations for a product with the ID 211
414
+
415
+
POST http://localhost:1260/odata/v1/Products(211)/CreateAttributeCombinations
416
+
417
+
As a first step this action always deletes all existing attribute combinations (for a product).
418
+
419
+
381
420
# More examples
382
421
383
422
#### Get installed payment methods
@@ -416,20 +455,6 @@ This request is called OData navigation. Use `BillingAddress` if you want the bi
416
455
The example uses SmNetFulfillCountry and SmNetFulfillStateProvince options to update the country (USA) and province (New York). That avoids extra querying of country and province records and passing its IDs in the request body.
417
456
Note that you cannot use a path `/Orders(145)/ShippingAddress` to update an address because `ShippingAddress` is a navigation property and updates are not supported here.
418
457
419
-
#### Get product with name *SmartStore eBay SmartSeller*
420
-
421
-
GET http://localhost:1260/odata/v1/Products?$top=1&$filter=Name eq 'SmartStore eBay SmartSeller'
422
-
423
-
#### Get child products of group product with ID 210
424
-
425
-
GET http://localhost:1260/odata/v1/Products?$top=120&$filter=ParentGroupedProductId eq 210
426
-
427
-
#### Get final price of product with ID 211
428
-
429
-
POST http://localhost:1260/odata/v1/Products(211)/FinalPrice
430
-
431
-
Note the post method. `FinalPrice` is an OData action because further data processing (price calculation) is required. There is a second action `LowestPrice` which serves the lowest possible price for a product.
432
-
433
458
#### Get email address of customer with ID 1
434
459
435
460
GET http://localhost:1260/odata/v1/Customers(1)/Email
@@ -442,6 +467,7 @@ Note the select option which tells OData just to return the Id property.
Copy file name to clipboardExpand all lines: src/Plugins/Api.WebApi/changelog.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,10 @@
1
1
#Release Notes#
2
2
3
+
##Web Api 1.22##
4
+
5
+
###New Features###
6
+
*#393 Implement OData actions for simpler working with product attributes -> added ProductsController.ManageAttributes and ProductsController.CreateAttributeCombinations.
0 commit comments