Filter BigCommerce products on a custom field using API - bigcommerce

I have products in my catalog that benefit from a rebate.
If a product does have a rebate, he has a custom field "rebate" set to 1.
I want to display a page with all products having a rebate, and I'm doing it trough the API.
As I'm new, I'm wondering what should be the syntax to get the custom field value and filter on it.
I'm testing with something like this :
https://api.bigcommerce.com/stores/{store_hash}/v3/catalog/products?include=custom_fields&rebate=1
But not working at all ... I'm getting a 422, saying that rebate is not a valid filter.
Thank you for your help,
Jaad

That's correct--custom_field keys are not a valid filter on a product request. To see the list of valid parameters you can use with a Get Product request, see our documentation here (expand the Query Params section):
https://developer.bigcommerce.com/api-reference/catalog/catalog-api/products/getproducts
You could make the request for all product data and sort the products by custom field key within your application. Or, if you wanted to limit the request to only rebate products, you could tag all rebate products in a Rebate category (this category could even be hidden). Then you could filter the request to get all products that are in that category:
https://api.bigcommerce.com/stores/{store_hash}/v3/catalog/products?categories:in={rebateCategoryID}

Related

when you add a BigCommerce product to Wishlist, the SKU is not added to {{wishlist.item}} object

When you add BigCommerce product to Wishlist, the SKU is not added to {{wishlist.item}} object.
I did a {{log wishlist}}, after the product is added, the SKU is null.
the item object has a lot of key fields that are null like availability, summary, stock_level and also boolean values like pre-order, has_options etc. How can i populate them when adding a product to wishlist?
Is there a way to pass the SKU thru "/wishlist.php?action=addWIshlist&product_id={{product.id}} ??
if possible, how and where can i use JS code to pass this value to the wishlist action everytime i add a product to wishlist?
According to BC's Wishlist Object documentation, you should have access to the product's SKU. Now, if you have SKUs set at the variant level, and are trying to access that, you will be out of luck. Products only get added to the wishlist at the product level, and do not contain any variant information.
The issue you might be having is you might be trying to access this data on a page where it is not exposed. The only page where this data is exposed is on the wishlist details page for that wishlist. To access it on another page, you would need to make an AJAX request to the wishlist details page.

In Strapi i can get a specific product but how do I get ALL products?

I set up a product collection type, added three records and in the browser type
localhost:1337/api/products/2 and it correctly displays record 2:
{"data":{"id":2,"attributes":{"title":"Gillette Razor","price":9.99,"description":"/assets/product-images/product-2.png","featured":true,"createdAt":"2022-08-20T12:23:10.685Z","updatedAt":"2022-08-20T12:29:45.062Z","publishedAt":null}},"meta":{}}
(also works for /1 and /3, showing those products).
But, when I try to see ALL products by typing:
localhost:1337/api/products I get:
{"data":[],"meta":{"pagination":{"page":1,"pageSize":25,"pageCount":0,"total":0}}}
I have given "public" access to "find" and "findOne". Server is running. Why is it not producing a list of the three products entered?
The solution was the data has to be "published" (default is "draft") for the /api/products to show all records, even though the /api/products/x had no issue revealing product x details without being published.
After marking the data as published localhost:1337/api/products now gives me ALL of my products:
{"data":[{"id":1,"attributes":{"title":"razor blade","price":1.99,"description":"/assets/product-images/product-1.png","featured":false,"createdAt":"2022-08-20T12:22:12.498Z","updatedAt":"2022-08-20T15:37:08.598Z","publishedAt":"2022-08-20T15:37:08.597Z"}},{"id":2,"attributes":{"title":"Gillette Razor","price":9.99,"description":"/assets/product-images/product-2.png","featured":true,"createdAt":"2022-08-20T12:23:10.685Z","updatedAt":"2022-08-20T15:37:01.649Z","publishedAt":"2022-08-20T15:37:01.648Z"}},{"id":3,"attributes":{"title":"Barber Razor","price":7.99,"description":"/assets/product-images/product-3.png","featured":null,"createdAt":"2022-08-20T12:23:52.749Z","updatedAt":"2022-08-20T15:36:52.579Z","publishedAt":"2022-08-20T15:36:52.577Z"}}],"meta":{"pagination":{"page":1,"pageSize":25,"pageCount":1,"total":3}}}

Flipkart Product API - How to get top selling product from the category

According to the flipkart product api we can get the top selling products from the category, but I'm not able to get the top selling products. According to the flipkart following is the sample url which return top selling products.
https://affiliate-api.flipkart.net/affiliate/1.0/topFeeds/fnkygygma/category/reh/55ab6c2673a4773ffb8e4019.json?expiresAt=1452881213871&sig=1c4c5111b6b014a71a17b229e6df6afc&inStock=true
I have following queries.
what is reh in the URL?
what is "55ab6c2673a4773ffb8e4019" in the URL is this category name, how I'll get the category name like this for other categories.
As I know "expiresAt" comes from flipkart, how I can generate this myself?
How I can generate "sig"?
it will be really helpful if someone answer for this.
My guess is you would have to query their database for the ID of the category that you want the top products from, and then use it in the URI when requesting the feed.
The documentation doesn't show "reh" in the URI so I'm guessing that sample is for testing purposes.
I found the section that says, "The Product Feed Listing API provides the full list of categories present in the catalogue."
The URI is: https://affiliate.flipkart.com/api-docs/af_prod_ref.html#product-feed-listing-api
You do realize that there is a new version of the API? It's 1.1
The documentation says that you have to request a list of the categories with this URI: https://affiliate-api.flipkart.net/affiliate/api/<trackingId>.json
Insert your ID where it says <trackingId> and it will return a list of the categories along with metaData.
The categories live in the apiListings section of the JSON response.

Magento API Rest filters

So I have this piece of code below which will sucessfully pull a product and give the XML data for my magento store...
http://mywebsite.com/api/rest/products?type=rest&filter[1][attribute]=name&filter[1][in]=test%20product%20name
However, it will ONLY pull up the product info if I make the product name perfect. If I try to just put in
http://mywebsite.com/api/rest/products?type=rest&filter[1][attribute]=name&filter[1][in]=test
It will not bring ANY products. It was my understanding that if I used the "[in]" filter that it should bring up all products containing the "test" word but it doesnt...
in - "equals any of" - returns items that are equal to the item(s) with the specified attribute(s)
Try to use 'like' ...
http://mywebsite.com/api/rest/products?type=rest&filter[1][attribute]=name&filter[1][like]=%test%

eBay API change currency of returned price

Is there a way to get an item in another currency using the eBay API?
Very simple. All you have to do is change the site ID parameter. Since you didn't specify a language, I'm going to assume you're doing this HTTP-GET and just parsing the XML. The same principles will apply regardless of how you do it, programatically or not.
For a URL:
"http://open.api.ebay.com/shopping"
?callname=GetSingleItem
&responseencoding=XML
&appid=[APPID]
&siteid=2 <------------This, for example, is Canada's siteid. 0 is US. This will change the currency returned under < ConvertedCurrentPrice>
&version=839
&ItemID=181195344321
Put it all together and you get this copy/paste-friendly "http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=[APPID]&siteid=2&version=839&ItemID=181195344321"
Make sure to use your app ID as the parameter.
You can use this call for currency change:
Currency type can be changed in Ebay while listing an item using Add Item call in Ebay's trading API.
http://developer.ebay.com/devzone/xml/docs/Reference/eBay/extra/additms.rqst.additmrqstcntnr.itm.crrncy.html
Thanks CedCommerce
You can and it's actually very simple. You can use the Shopping API GetSingleItem.
Depending on what currency you are interested in, all you have to do is change the SiteID on which you are making the call. For example, if you want to get the price in EUR, you can set the SiteID to 3(UK), or 77(Germany). You will also have to set the IncludeSelector to "Details". This way, you will get a response that will contain the following fields.
<ConvertedCurrentPrice currencyID="GBP">68.55</ConvertedCurrentPrice>
<CurrentPrice currencyID="USD">92.9</CurrentPrice>
where the CurrentPrice is the original price of the listing, on the ebay site the listing was made, and the ConvertedCurrentPrice is the price of the listing on the site that corresponds to the SiteID you supplied.
You can see a full list of SiteIDs with the currencies they are using here