How to get /admin/products.json in a chronological order? - shopify

I need to be able to poll more than 250 products from the Shopify API. In order to do so, I need to retrieve the products from the API in a chronological order, with the oldest products first. Once I have the first 250 items, I retrieve another 250 items filtered by max_created_at.
I noticed that: GET /admin/products.json returns the products in a random order, but GET /admin/products.json?since_id=0 returns the products in a chronological order. Is this the intended behaviour? Or is there a flag that I can send with GET /admin/products.json to specify the sorting order?
Edit: I guess my question boils down to this: Is there a field that I can set that the results returned by the Shopify API will be ordered by?

Maybe the API has been updated since the last post but now you can do that like that :
https://yourshop.myshopift.com/admin/products.json?limit=50&fields=id,images,title&order=created_at+desc
Just add the query string parameter order=created_at+asc
This is an undocumented feature but it seems to work for most fields.

This is unintended behaviour, reliable sort orders for Product are limited to title and total, and then filtering options are as listed in the API docs.

Related

Is there an API call to list all available product id's (ID's alone) in Shopify?

I use POSTMAN GUI for retrieving a list of items from Shopify API.
I would like to know if there exists a way to get available product id's alone, preferably as a list of values over a single api GET call. The one I know of is
/admin/api/2022-04/products.json
It returns a list of all product information, and looping over them/traversing the json is not very efficient. I hope there must be an easy way to fetch all ID's alone in one go. Should there be not?
You can add /admin/api/2022-04/products.json?fields=id to the end of your request to limit the output only for a single field or multiply.
Please note that if you have more than 250 products you will need to make more than one request, since the request is limited to 250 products.
You can make one call to the Admin API for all your product IDs using the Bulk Query. That will result in you receiving a URL where you download a file in JSONL format with every single product ID in your store, without the paging or limits of other approaches.

How to get a list of products by ItemID Ebay SDK

I would like to get a list of products filtered by their ItemID ?
I successfully retrieved a list of products filtered by date using the GetSellerList Call on Ebay SDK.
I saw there is a kind of getItem method but it seems to return only one item. Is there a way to do it without calling multiple times the getItem API method ?
https://developer.ebay.com/DevZone/shopping/docs/CallRef/GetMultipleItems.html
I think You are looking for GetMultipleItems() method from ebaysdk.shopping as above.
You can retrieve maximum 20 items per one query.

Get seller items count by various criteria

I want to retrieve the total number of items of a seller, by various aspects like number of all items, number of active items, number of sold items, number of returned items, etc. I just need the count, not the complete item details. Couldn't find any good API for that.
GetMyeBaySelling does return the items by various aspects but it returns the complete item details. I can't find any option to 'exclude' item details from the results, so that only pagination is returned that gives the total count.
What other method in the eBay API can I use to achieve this purpose?
In order to get the number of items only you can add an OutputSelector to the GetMyeBaySelling call. For you purpose <OutputSelector>TotalNumberOfEntries</OutputSelector> would be sufficient. But you are able to add more OutputSelectors according to your needs. For most of the eBay Trading API calls the OutputSelector field is available.
I've created an example for the GetMyeBaySelling call in our API playground with the OutputSelectors "TotalNumberOfEntries" and "Summary". Feel free to modify the call and see the result directly in the response area. For example if you don't need the Summary just remove the field from the request.

BigCommerce API - How do I sort orders to return the most recent order first

This seems like a simple question, maybe I am missing something but I can't seem to find the answer.
Using the BigCommerce API, how do I retrieve a list of orders sorted by most recent order first? I can't seem to find any way to specify how objects are sorted/ordered and by default it returns the oldest item first.
How do I retrieve a list of the 25 most recent orders?
Bigcommerce API v2 support sorting via sort GET parameter, try:
/api/v2/orders?sort=date_created:desc&limit=25

How to get item in REST API by multiple item id

I have product_id and onec_id columns to get items from DB. Which API routes should I use to get items by product_id or by onec_id?
Is it right for REST routes?
GET /products/{product_id}
GET /products/get_by_onec_id/{onec_id}
The most REST solution is to fire one HTTP request for each id. For example
GET /product/736
REST is intended to represent the state of a resource. It can return a set of items, but only if these items relate to each other in some way. For example
GET /onec/492/products
Will return the set of products associated with the specified onec.
If you want to return the set of products identified by a set of IDs in a single request, you may have your shortcut syntax like
GET /products/12,768,56,086
But it's not really common because it's quite a departure from the REST objectives
To get a single Product or Onec(?), GET
/products/{id}
/onecs/{id}