Can I use arguments like sortKeysortKey while getting collection data?

I want to get collection products sorted in a specific order - and hence pass sortKey as an argument to get best selling products first.
Don’t see an option within flow UI.
My use case is to automatically update bestseller tag across to bestselling products. So the approach was to get first 20 products from a ‘best sellers’ collection on admin which has all the products I want to include (from specific product types etc.)

If I can just sort data while receiving, I can tag first 20 and be done.
Otherwise would need to look into alternative way to sort data.

I think you want “Sort data by” unless I’m missing something. Flow includes all of the available sort options, but it’s possible the API changed since we built the action. Do you see something missing?

@paul_n “Sort data by” is for sorting the collections, I’m looking to sort the products within the returned collection.
My link was incorrect, sorry for the confusion, this is the query I want to recreate.

query GetBestSellingProducts($collectionId: ID!) {
  collection(id: $collectionId) {
    id
    title
    sortOrder
    products(first: 20, sortKey: BEST_SELLING) {
      edges {
        node {
          id
          tags
        }
      }
    }
  }
}

This allows me to get products sorted as best selling, while fetching a collection.
Ofcourse I can have set the collection rules to sort by best selling within admin, but I don’t know if API returns data in that order.

Also open to any alternative ideas to get best sellers.
I just want to automate tagging best sellers.

Got it. Yeah, Flow doesn’t allow sorting via the query. We just grab all of the products for you and handle paging. You could potentially query using Send HTTP request instead, which now returns data. The issue there is you won’t be able to page through it very easily, but if you don’t need that it might work fine.

You could also potentially sort after it’s in Flow via Run code.