question

Andrew Roper avatar image
Andrew Roper asked

REST API: GET /nodes with sort returns photos in random/wrong order

Greetings, We have recently implemented support for pulling images from our customers' cloud drives on a site we work on. At the moment we are pulling a flat list of images and trying to sort them, newest to oldest. Currently we are using the following query: /nodes?filters=kind:FILE AND contentProperties.contentType:image*&sort:[\"createdDate DESC\"] * you can go here and click "Amazon cloud drive": https://staging.pictli.com/orders/new?#/products/98 The order of the results changes every time. We've also tried: /nodes?filters=kind:FILE AND contentProperties.contentType:image*&sort:[\"contentDate DESC\"]" and: /nodes?filters=kind:FILE AND contentProperties.contentType:image*&sort:[\"name DESC\"]" And in all cases we don't get images back in the order that matches what we see in the cloud drive web interface. Is it possible with a single query to get newest images first? If not, why, and, can what do we need to do instead? Best, Andrew Roper andrew@buildproto.com
amazon drive
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Levon@Amazon avatar image
Levon@Amazon answered
Hi Andrew, Welcome to dev forums and thanks for bringing this up. We will investigate why the sort order is different. Thanks!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Levon@Amazon avatar image
Levon@Amazon answered
Hi Andrew, We are confident that this is not related to any current known issues, and at this stage we need more data to investigate. Can you please provide some more data about your observations? You state that it happens every time. You've already provided the requests you're trying. Can you provide the metadata of a few files that are not staying consistent? Thanks!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rambalac avatar image
rambalac answered
[i]sort[b]=[/b]["[/i] not [i]sort[b]:[/b]["[/i] And [" should be properly encoded
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andrew Roper avatar image
Andrew Roper answered
Thanks! The key was `sort=` as opposed to `sort:` The docs weren't super clear on this point -- would be great to see an example in there with a full URL that includes a `sort` component. Cheers. -Andrew
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rambalac avatar image
rambalac answered
"Documentation" has numerous mistakes in any command and option examples including sorting.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.