VirtoCommerce API getting item prices - virtocommerce

I am using VirtoCommerce 2.9 and have some questions regarding the API and what would be the best way to get all the information I need, while keeping the number of API requests down.
Right now I am using the endpoint /api/catalog/search to find items that matches a number of attributes. But the response does not include prices and product texts. Both I would like to present to the end user. What would be the correct or best way to retrieve this information?
Thanks!
Cheers!

Currently search service does not return the description and price for the products.
To get this details you need to use separate queries
api/catalog/product/ids?respGroup='ItemSmall'
to get product detail with description and
api/pricing/evaluate
to retrieve actual products prices. You can call them in parallel for better performance.
Be aware to use WithProperties response group because it may cause
perfomance problem. Anyway product returned with all properties values
and this 'response group' is only responsible for retrieving properties meta-information
(as possible dictionary values, multilingual, required or optional flag etc) this information often used in admin area and in storefront almost not used.
Indexed search module will be serious changed in future versions, and you will be able to have more control over the product details in the search index.

Related

REST API - Reduce number of POSTS operations

I have designed some API which have some nested resources and I am wondering how to reduce the number of POSTS when I am creating some records.
for example, I have the following resources:
/orders/
and
/orders/{order_id}/products/
at the moment I need to run two POST separately if I need to create a new order or a new order's product but I would like to reduce the time for this and run only one POST.
Is this possible? is there any documentation I can read about this?
Thank you
Although you might have found your answer in an other thread there is still some issue regarding your endpoint design.
The first intuition that your endpoint give is that product resource could exist in several place.
./orders/{order_id}/products/{prod_id}
./products/{prod_id}
The question you should ask yourself is: Do you really want to refer to product?
Can product be leaving outside of any orders?
Having a resource sitting in 2 different place might not be that great as you are managing 2 different endpoint with similar behavior. Keeping consistency between both endpoint is not that easy.
My 2 cent is to avoid the term product as it can be confused with a single instance of a product. For example if you sell a toothbrush branded AAA, sku 1234 an order is not compose by this product but by one off the item that you have in stock. The item is "instance" of the toothbrush branded AAA, sku 1234.
As I understand your question you are not really referring to a product but more to a stock-item which should be a unique id.
The resource stock-item if you decide to have one should exist prior to the order. I guess the customer is not adding item to your stock and at the same time purchasing this item.
In conclusion I think that you are not creating the stock-item resource at all when creating orders but just making a reference to it.

Bigcommerce API Get All Skus

I'm trying to load all Skus from a Bigcommerce store. I first tried to use the API path /products/skus/count to get a count of the number of skus in the store as outlined in the BC documentation at https://developer.bigcommerce.com/api/stores/v2/products/skus However, the /products/skus/count endpoint is returning {"count":0}. I know for a fact that I have hundreds of products with a sku. Ultimately I'd like to get a list or array of just the skus in my store. Has anyone else been able to use this API or know a way to load all the skus in my store without loading all the product object graphs as that is too slow of a solution as I don't need all the additional information nor do I want to page through all my products since it's limited to 250 items at a time. All of my other API calls are working great so I'm questioning whether there is an issue with the specific API.
Are you try to get the "sku" property for all products or the SKU resource associated with a product?
The api call at the url that you've given https://developer.bigcommerce.com/api/stores/v2/products/skus
will return all the SKU resource/object associated with a product. You can either get skus for all products using the resource "products/skus/count" or a specific product using "products/{productid}/skus/count". Both calls works as documented.

POST Order with values for configurable product fields?

I've successfully got 3rd party merchant orders posting new orders to my client's BigCommerce store programmatically. I've even got product options posting as part of the order (product->option set-> option relationships are a total cluster).
My client relies heavily on configurable fields. I'm able to pull the definitions of the configurable fields for each product, but can't find a way to POST or update the configurable field values through the API.
Is it possible to manipulate an order's configurable fields through the API?
Got a response from the support team # BigCommerce. Manipulating configurable fields via the API is not currently possible and not currently on the roadmap.
Original reply below:
Unfortunately that is a product limitation with the API, it will not tie to configurable fields on the product. The best you can do is attach that information through a generic text field like 'staff_notes'. Honestly I have not heard of any talk of adding a way to add products with configurable fields to orders via the API. I think this may be because anything that can be done with configurable fields can be done with options and options are what is being pushed for the future. I have noted this feedback down though and will pass it along to our Product Manager for the API. Best case scenario is that it may be seen in a future version of the API which is at least several months away.

Ebay API - How to get an item's ancestor/root category?

I'm retrieving the item info of many items using getMultipleItems in the Shopping API, and I need to find-out the items' root category. In the US site (0), the root categories are here: http://www.isoldwhat.com/getcats/fullcategorytree.php
How can I tell which of these an item belongs to (for example, "Computers/Tablets & Networking")? Can I do it within getMultipleItems (or getSingleItem) or do I need another call?
It seems like a short question, but this problem is shared with my use of the Amazon API to which I've been doing extensive research and I decided to resolve it on my eBay end. The "problem" is determining the selling fee, which can be done on Amazon's side, by getting the ProductGroup of the item, or by using eBay's root categories, and matching either one to the fee table Amazon defined for it's commission rates. In this case, there's not a lot of turn-out to refer to here to show I looked everything up.
The getCategoryInfo and related category-info-searching doesn't pertain to particular items. I get a <primarycategoryid> N/V pair in my item responses, but (I'm pretty sure) that's a leaf category (mapping 10,000+ leaf categories [even just the fraction I would use] to Amazon's product group-specific fee table would be a hell of a pain).
Again, how do I trace an <item> to it's ancestor/root category?
You can trace the root of a category via the PrimaryCategoryIDPath field that is returned when calling GetMultipleItems.
Keep in mind that this information is not returned unless you have specified Details in the IncludeSelector field as part of your request.
More information on PrimaryCategoryIDPath can be found here.

eBay API - filter items by store/custom categories

My scenario: I have a client with an eBay store with custom categories. On their website, they would like to list the items they have for sale. They would like this list to be filterable by custom category.
I've been searching for a couple days now, and I'm still a bit unsure about the best way to proceed.
From what I can gather, the only way to get a list of categories defined in a store is through the GetStore call in the Trading API. This seems to be supported, though I need to get a user token from my client's eBay account. I will assume this works.
I do not, however, see any method of filtering items based on custom categories. I've looked through the documentation of both the Trading and Finding APIs, but all I see are filters on pre-defined eBay categories.
Is it possible to filter on custom/store categories?
I had a task to link seller products to custom categories and the only way I found is to retrieve a list of custom categories with "GetStore" from Trading API, retrieve all seller items with "findItemsAdvanced" call form Finding API, and loop through all retrieved items and get details with "GetItem" call from Trading API.
After that I could find custom categories under $xml->Item->Storefront->StoreCategoryID and $xml->Item->Storefront->StoreCategory2ID.
After digging through and posting in the eBay forums, I found out that no, it is not possible to filter on custom/store defined categories via the API. The only way to filter on custom/store defined categories is on the eBay hosted store.
This is apparently eBay's way to make the store hosted on their site more feature rich than anything you can do via the API.
Even though this question is old, I believe it interesting to give a more recent answer. As stated above, you cannot directly filter items sold by a store using custom store categories (StoreCategoryID). The easiest way to work around this is using the GetSellerList API using a coarse granularity level, which allows you to get the storeCategoryID of each Item on sale within a starting time range or an end time range. You can then filter the items yourself. Here's a link to a forum answer: https://ebay.custhelp.com/app/answers/detail/a_id/1178
Yes no way to get items by Custom categories.
It sounds like either getCategoryInfo or GetCategories might help you.