#50083 closed enhancement (invalid)
Using _fields in api with array result json
Reported by: | murzai | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
Hi,
I am using wp-json/wc/v3/products/batch api, and result with "update", "create", "delete" tags.
But i dont want to get all fields from json. _fields param is working with get a product json. But products/batch is return json like that
{ "update": [ { "id": 8543, "name": "AIO 21.5\" AVANTRON 46-DG2112 İ5M 3.NESİL 8GB DDR3 120GB SSD O\/B E.KARTI", "slug": "aio-21-5-avantron-46-dg2112-i5m-3-nesil-8gb-ddr3-120gb-ssd-o-b-e-karti", "permalink": "https:\/\/bilgisayarmagazam.com\/aio-21-5-avantron-46-dg2112-i5m-3-nesil-8gb-ddr3-120gb-ssd-o-b-e-karti", "date_created": "2020-04-20T15:44:23", "date_created_gmt": "2020-04-20T12:44:23", "date_modified": "2020-05-04T21:43:13", "date_modified_gmt": "2020-05-04T18:43:13", "type": "simple", "status": "publish", "featured": false, "catalog_visibility": "visible", "description": "<div><img src=\"http:\/\/bilgisayarmagazam.com\/wp-content\/uploads\/kargo_uyari.png\" alt=\"Uyari.png (69 KB)\" width=\"1000\" height=\"249\" style=\"margin-left: auto;margin-right: auto\" \/> <\/div><div><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/banner-hediye-drweb.jpg\" \/><\/div><div><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/wifihediye.jpg\" \/><\/div><div><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/firimatanitim.jpg\" \/><br \/><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/AV03746_6.jpg\" alt=\"AV03746.jpg (394 KB)\" width=\"1187\" height=\"1415\" \/><br \/><div><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/sertifika.jpg\" \/><\/div><div><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/firimatanitim_alt.jpg\" \/><\/div><\/div>", "short_description": "", "sku": "AV03746", "price": "2393.689", "regular_price": "2393.689", "sale_price": "", "date_on_sale_from": null, "date_on_sale_from_gmt": null, "date_on_sale_to": null, "date_on_sale_to_gmt": null, "price_html": "<span class=\"woocommerce-Price-amount amount\">2.393,69 <span class=\"woocommerce-Price-currencySymbol\">₺ Kdv Dahil <\/span><\/span>", "on_sale": false, "purchasable": true, "total_sales": 0, "virtual": false, "downloadable": false, "downloads": [], "download_limit": -1, "download_expiry": -1, "external_url": "", "button_text": "", "tax_status": "taxable", "tax_class": "", "manage_stock": true, "stock_quantity": 3, "stock_status": "instock", "backorders": "no", "backorders_allowed": false, "backordered": false, "sold_individually": false, "weight": "", "dimensions": { "length": "", "width": "", "height": "" }, "shipping_required": true, "shipping_taxable": true, "shipping_class": "", "shipping_class_id": 0, "reviews_allowed": true, "average_rating": "0", "rating_count": 0, "related_ids": [ 8168, 8170, 7805, 8173, 8182 ], "upsell_ids": [], "cross_sell_ids": [], "parent_id": 0, "purchase_note": "", "categories": [ { "id": 1074, "name": "All İn One Bilgisayar", "slug": "all-in-one-bilgisayar" } ], "tags": [], "images": [ { "id": 20408, "date_created": "2020-04-30T15:39:04", "date_created_gmt": "2020-04-30T10:39:04", "date_modified": "2020-04-30T15:39:04", "date_modified_gmt": "2020-04-30T10:39:04", "src": "https:\/\/bilgisayarmagazam.com\/wp-content\/uploads\/AV03746_1.jpg", "name": "AV03746_1", "alt": "" }, { "id": 20409, "date_created": "2020-04-30T15:39:09", "date_created_gmt": "2020-04-30T10:39:09", "date_modified": "2020-04-30T15:39:09", "date_modified_gmt": "2020-04-30T10:39:09", "src": "https:\/\/bilgisayarmagazam.com\/wp-content\/uploads\/AV03746_2.jpg", "name": "AV03746_2", "alt": "" }, { "id": 20410, "date_created": "2020-04-30T15:39:12", "date_created_gmt": "2020-04-30T10:39:12", "date_modified": "2020-04-30T15:39:12", "date_modified_gmt": "2020-04-30T10:39:12", "src": "https:\/\/bilgisayarmagazam.com\/wp-content\/uploads\/AV03746_3.jpg", "name": "AV03746_3", "alt": "" }, { "id": 20411, "date_created": "2020-04-30T15:39:16", "date_created_gmt": "2020-04-30T10:39:16", "date_modified": "2020-04-30T15:39:16", "date_modified_gmt": "2020-04-30T10:39:16", "src": "https:\/\/bilgisayarmagazam.com\/wp-content\/uploads\/AV03746_4.jpg", "name": "AV03746_4", "alt": "" } ], "attributes": [ { "id": 38, "name": "Durum", "position": 10, "visible": true, "variation": false, "options": [ "Sıfır" ] }, { "id": 25, "name": "Bilgisayar Ürün Tipi", "position": 30, "visible": true, "variation": false, "options": [ "All In One" ] }, { "id": 132, "name": "Platform Tipi", "position": 35, "visible": true, "variation": false, "options": [ "AIO" ] }, { "id": 115, "name": "Kullanım Amacı", "position": 40, "visible": true, "variation": false, "options": [ "Ofis" ] }, { "id": 41, "name": "Ekran Boyutu", "position": 50, "visible": true, "variation": false, "options": [ "21.5 İnç" ] }, { "id": 42, "name": "Ekran Çözünürlüğü", "position": 60, "visible": true, "variation": false, "options": [ "1920x1080" ] }, { "id": 5, "name": "İşlemci", "position": 70, "visible": true, "variation": false, "options": [ "Var" ] }, { "id": 82, "name": "İşlemci Tipi", "position": 75, "visible": true, "variation": false, "options": [ "Core i5" ] }, { "id": 78, "name": "İşlemci Markası", "position": 80, "visible": true, "variation": false, "options": [ "Intel" ] }, { "id": 79, "name": "İşlemci Modeli", "position": 82, "visible": true, "variation": false, "options": [ "Diğer" ] }, { "id": 81, "name": "İşlemci Soket Tipi", "position": 90, "visible": true, "variation": false, "options": [ "MOBIL" ] }, { "id": 80, "name": "İşlemci Nesli", "position": 120, "visible": true, "variation": false, "options": [ "3. Nesil" ] }, { "id": 76, "name": "İşlemci Çekirdek Sayısı", "position": 130, "visible": true, "variation": false, "options": [ "2" ] }, { "id": 77, "name": "İşlemci Frekansı", "position": 140, "visible": true, "variation": false, "options": [ "2.51 GHz - 2.90 GHz" ] }, { "id": 141, "name": "Ram Bellek", "position": 160, "visible": true, "variation": false, "options": [ "Var" ] }, { "id": 22, "name": "Bellek Kapasitesi", "position": 170, "visible": true, "variation": false, "options": [ "8 GB" ] }, { "id": 23, "name": "Bellek Türü", "position": 180, "visible": true, "variation": false, "options": [ "DDR3" ] }, { "id": 21, "name": "Bellek Hızı", "position": 190, "visible": true, "variation": false, "options": [ "1600 MHz" ] }, { "id": 149, "name": "Sabit Disk (SSHD)", "position": 195, "visible": true, "variation": false, "options": [ "Yok" ] }, { "id": 148, "name": "Sabit Disk (SSD)", "position": 200, "visible": true, "variation": false, "options": [ "Var" ] }, { "id": 147, "name": "Sabit Disk (HDD)", "position": 210, "visible": true, "variation": false, "options": [ "Yok" ] }, { "id": 67, "name": "HDD Kapasitesi SSD", "position": 220, "visible": true, "variation": false, "options": [ "120 GB" ] }, { "id": 68, "name": "HDD Kapasitesi Toplam", "position": 260, "visible": true, "variation": false, "options": [ "120 GB" ] }, { "id": 58, "name": "Harici Ekran Kartı", "position": 265, "visible": true, "variation": false, "options": [ "Yok" ] }, { "id": 45, "name": "Ekran Kartı Kapasitesi", "position": 270, "visible": true, "variation": false, "options": [ "O\/B VGA" ] }, { "id": 46, "name": "Ekran Kartı Modeli", "position": 280, "visible": true, "variation": false, "options": [ "Yok" ] }, { "id": 109, "name": "Klavye Mouse Set", "position": 330, "visible": true, "variation": false, "options": [ "Var" ] }, { "id": 83, "name": "İşletim Sistemi", "position": 340, "visible": true, "variation": false, "options": [ "Wın Deneme Sürümü" ] }, { "id": 51, "name": "Garanti", "position": 350, "visible": true, "variation": false, "options": [ "Var, Başlamamış" ] }, { "id": 53, "name": "Garanti Süresi", "position": 360, "visible": true, "variation": false, "options": [ "2 Yıl-3 Yıl" ] }, { "id": 52, "name": "Garanti Geçerlilik Yeri", "position": 370, "visible": true, "variation": false, "options": [ "Türkiye" ] }, { "id": 117, "name": "Marka", "position": 380, "visible": true, "variation": false, "options": [ "Avantron" ] } ], "default_attributes": [], "variations": [], "grouped_products": [], "menu_order": 0, "meta_data": [], "store": { "id": 1, "name": "saimkaya", "shop_name": "", "url": "https:\/\/bilgisayarmagazam.com\/store\/saim-kaya\/", "address": [] }, "_links": { "self": [ { "href": "https:\/\/bilgisayarmagazam.com\/wp-json\/wc\/v3\/products\/8543" } ], "collection": [ { "href": "https:\/\/bilgisayarmagazam.com\/wp-json\/wc\/v3\/products" } ] } }, { "id": 8544, "name": "AIO 21.5\" AVANTRON 47-DG2112 İ5M 3.NESİL 4GB DDR3 240GB SSD O\/B E.KARTI", "slug": "aio-21-5-avantron-47-dg2112-i5m-3-nesil-4gb-ddr3-240gb-ssd-o-b-e-karti", "permalink": "https:\/\/bilgisayarmagazam.com\/aio-21-5-avantron-47-dg2112-i5m-3-nesil-4gb-ddr3-240gb-ssd-o-b-e-karti", "date_created": "2020-04-20T15:44:23", "date_created_gmt": "2020-04-20T12:44:23", "date_modified": "2020-05-04T21:43:13", "date_modified_gmt": "2020-05-04T18:43:13", "type": "simple", "status": "publish", "featured": false, "catalog_visibility": "visible", "description": "<div><img src=\"http:\/\/bilgisayarmagazam.com\/wp-content\/uploads\/kargo_uyari.png\" alt=\"Uyari.png (69 KB)\" width=\"1000\" height=\"249\" style=\"margin-left: auto;margin-right: auto\" \/> <\/div><div><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/banner-hediye-drweb.jpg\" \/><\/div><div><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/wifihediye.jpg\" \/><\/div><div><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/firimatanitim.jpg\" \/><br \/><br \/><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/AV03747_6.jpg\" alt=\"AV03747.jpg (394 KB)\" width=\"1187\" height=\"1415\" \/><br \/><div><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/sertifika.jpg\" \/><\/div><div><img src=\"https:\/\/www.bilgisayarmagazam.com\/wp-content\/uploads\/firimatanitim_alt.jpg\" \/><\/div><br \/><br \/><br \/><\/div>", "short_description": "", "sku": "AV03747", "price": "2377.1808", "regular_price": "2377.1808", "sale_price": "", "date_on_sale_from": null, "date_on_sale_from_gmt": null, "date_on_sale_to": null, "date_on_sale_to_gmt": null, "price_html": "<span class=\"woocommerce-Price-amount amount\">2.377,18 <span class=\"woocommerce-Price-currencySymbol\">₺ Kdv Dahil <\/span><\/span>", "on_sale": false, "purchasable": true, "total_sales": 0, "virtual": false, "downloadable": false, "downloads": [], "download_limit": -1, "download_expiry": -1, "external_url": "", "button_text": "", "tax_status": "taxable", "tax_class": "", "manage_stock": true, "stock_quantity": 3, "stock_status": "instock", "backorders": "no", "backorders_allowed": false, "backordered": false, "sold_individually": false, "weight": "", "dimensions": { "length": "", "width": "", "height": "" }, "shipping_required": true, "shipping_taxable": true, "shipping_class": "", "shipping_class_id": 0, "reviews_allowed": true, "average_rating": "0", "rating_count": 0, "related_ids": [ 7805, 8172, 8183, 8168, 7973 ], "upsell_ids": [], "cross_sell_ids": [], "parent_id": 0, "purchase_note": "", "categories": [ { "id": 1074, "name": "All İn One Bilgisayar", "slug": "all-in-one-bilgisayar" } ], "tags": [], "images": [ { "id": 20413, "date_created": "2020-04-30T15:39:26", "date_created_gmt": "2020-04-30T10:39:26", "date_modified": "2020-04-30T15:39:26", "date_modified_gmt": "2020-04-30T10:39:26", "src": "https:\/\/bilgisayarmagazam.com\/wp-content\/uploads\/AV03747_1.jpg", "name": "AV03747_1", "alt": "" }, { "id": 20414, "date_created": "2020-04-30T15:39:30", "date_created_gmt": "2020-04-30T10:39:30", "date_modified": "2020-04-30T15:39:30", "date_modified_gmt": "2020-04-30T10:39:30", "src": "https:\/\/bilgisayarmagazam.com\/wp-content\/uploads\/AV03747_2.jpg", "name": "AV03747_2", "alt": "" }, { "id": 20415, "date_created": "2020-04-30T15:39:34", "date_created_gmt": "2020-04-30T10:39:34", "date_modified": "2020-04-30T15:39:34", "date_modified_gmt": "2020-04-30T10:39:34", "src": "https:\/\/bilgisayarmagazam.com\/wp-content\/uploads\/AV03747_3.jpg", "name": "AV03747_3", "alt": "" }, { "id": 20416, "date_created": "2020-04-30T15:39:38", "date_created_gmt": "2020-04-30T10:39:38", "date_modified": "2020-04-30T15:39:38", "date_modified_gmt": "2020-04-30T10:39:38", "src": "https:\/\/bilgisayarmagazam.com\/wp-content\/uploads\/AV03747_4.jpg", "name": "AV03747_4", "alt": "" } ], "attributes": [ { "id": 38, "name": "Durum", "position": 10, "visible": true, "variation": false, "options": [ "Sıfır" ] }, { "id": 25, "name": "Bilgisayar Ürün Tipi", "position": 30, "visible": true, "variation": false, "options": [ "All In One" ] }, { "id": 132, "name": "Platform Tipi", "position": 35, "visible": true, "variation": false, "options": [ "AIO" ] }, { "id": 115, "name": "Kullanım Amacı", "position": 40, "visible": true, "variation": false, "options": [ "Ofis" ] }, { "id": 41, "name": "Ekran Boyutu", "position": 50, "visible": true, "variation": false, "options": [ "21.5 İnç" ] }, { "id": 42, "name": "Ekran Çözünürlüğü", "position": 60, "visible": true, "variation": false, "options": [ "1920x1080" ] }, { "id": 5, "name": "İşlemci", "position": 70, "visible": true, "variation": false, "options": [ "Var" ] }, { "id": 82, "name": "İşlemci Tipi", "position": 75, "visible": true, "variation": false, "options": [ "Core i5" ] }, { "id": 78, "name": "İşlemci Markası", "position": 80, "visible": true, "variation": false, "options": [ "Intel" ] }, { "id": 79, "name": "İşlemci Modeli", "position": 82, "visible": true, "variation": false, "options": [ "Diğer" ] }, { "id": 81, "name": "İşlemci Soket Tipi", "position": 90, "visible": true, "variation": false, "options": [ "MOBIL" ] }, { "id": 80, "name": "İşlemci Nesli", "position": 120, "visible": true, "variation": false, "options": [ "3. Nesil" ] }, { "id": 76, "name": "İşlemci Çekirdek Sayısı", "position": 130, "visible": true, "variation": false, "options": [ "2" ] }, { "id": 77, "name": "İşlemci Frekansı", "position": 140, "visible": true, "variation": false, "options": [ "2.51 GHz - 2.90 GHz" ] }, { "id": 141, "name": "Ram Bellek", "position": 160, "visible": true, "variation": false, "options": [ "Var" ] }, { "id": 22, "name": "Bellek Kapasitesi", "position": 170, "visible": true, "variation": false, "options": [ "4 GB" ] }, { "id": 23, "name": "Bellek Türü", "position": 180, "visible": true, "variation": false, "options": [ "DDR3" ] }, { "id": 21, "name": "Bellek Hızı", "position": 190, "visible": true, "variation": false, "options": [ "1600 MHz" ] }, { "id": 149, "name": "Sabit Disk (SSHD)", "position": 195, "visible": true, "variation": false, "options": [ "Yok" ] }, { "id": 148, "name": "Sabit Disk (SSD)", "position": 200, "visible": true, "variation": false, "options": [ "Var" ] }, { "id": 147, "name": "Sabit Disk (HDD)", "position": 210, "visible": true, "variation": false, "options": [ "Yok" ] }, { "id": 67, "name": "HDD Kapasitesi SSD", "position": 220, "visible": true, "variation": false, "options": [ "240 GB" ] }, { "id": 68, "name": "HDD Kapasitesi Toplam", "position": 260, "visible": true, "variation": false, "options": [ "240 GB" ] }, { "id": 58, "name": "Harici Ekran Kartı", "position": 265, "visible": true, "variation": false, "options": [ "Yok" ] }, { "id": 45, "name": "Ekran Kartı Kapasitesi", "position": 270, "visible": true, "variation": false, "options": [ "O\/B VGA" ] }, { "id": 46, "name": "Ekran Kartı Modeli", "position": 280, "visible": true, "variation": false, "options": [ "Yok" ] }, { "id": 109, "name": "Klavye Mouse Set", "position": 330, "visible": true, "variation": false, "options": [ "Var" ] }, { "id": 83, "name": "İşletim Sistemi", "position": 340, "visible": true, "variation": false, "options": [ "Wın Deneme Sürümü" ] }, { "id": 51, "name": "Garanti", "position": 350, "visible": true, "variation": false, "options": [ "Var, Başlamamış" ] }, { "id": 53, "name": "Garanti Süresi", "position": 360, "visible": true, "variation": false, "options": [ "2 Yıl-3 Yıl" ] }, { "id": 52, "name": "Garanti Geçerlilik Yeri", "position": 370, "visible": true, "variation": false, "options": [ "Türkiye" ] }, { "id": 117, "name": "Marka", "position": 380, "visible": true, "variation": false, "options": [ "Avantron" ] } ], "default_attributes": [], "variations": [], "grouped_products": [], "menu_order": 0, "meta_data": [], "store": { "id": 1, "name": "saimkaya", "shop_name": "", "url": "https:\/\/bilgisayarmagazam.com\/store\/saim-kaya\/", "address": [] }, "_links": { "self": [ { "href": "https:\/\/bilgisayarmagazam.com\/wp-json\/wc\/v3\/products\/8544" } ], "collection": [ { "href": "https:\/\/bilgisayarmagazam.com\/wp-json\/wc\/v3\/products" } ] } }, { "id": 234238543, "error": { "code": "woocommerce_rest_product_invalid_id", "message": "Geçersiz kimlik.", "data": { "status": 400 } } } ] }
i want to just id in "update, create and delete tags arrays.
it can be using wp-json/wc/v3/products/batch?_fields=update.0.name with first raw,
but i want to get all rows, i can not find any way to get only id and name fields for example.
update.0.name getting only name but, 0 mean row 0, but i post 100 products, and how can get 100 products only 2 fields like id and name
Best Regards
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hello, and thank you for submitting a ticket! This trac is focused on changes to the underlying WordPress REST API infrastructure and the endpoints which ship with core — unfortunately, the endpoints you are linking to look like they’re provided by WooCommerce, not WordPress itself. We therefore don’t have any ability to support the endpoint you’re are discussing in this system. I’d encourage you to open this ticket with WooCommerce.