My Products
Help
Florian Haase
PARTNER

Inventory Get SortOrder

by Florian Haase

Hi

 

just a question: Is the paged response from the Inventory Get Endpoint ordered by LastModifiedDateTime? Due to the performance issues we have to handle the responses by page to avoid timeouts on our site. But we have to be sure, that the responses are ordered by LastModifiedDateTime otherwise we will miss some changes in doing it that way...

 

best regards,

 

Florian

5 REPLIES 5
Yıldırım
VISMA

by Yıldırım (Updated ‎08-02-2022 16:44 by Yıldırım VISMA )

Hello, 

 

GET - Inventory sorted based on "inventoryId" field when the "LastModifiedDateTime" parameter is not used with the pagination. Clients should use the pagination in combination with a filter on "LastModifiedDateTime" (where is available). By doing this, you will only get documents which have changed since the last GET operation was executed.

 

Also, clients should avoid requiring the same data all the time, so the client should store the latest received "lastModifiedDatetime" in addition to the data has been fetched. In this way, this can be used as a cursor to restart/continue the query from. 

 

( LastModifiedDatetime=YYYY-MM-DD &  LastModifiedDatetimeCondition= >= )

Florian Haase
PARTNER

by Florian Haase

Yes, we are aware of that, but do I understand you right: If we use the filter on LastModifiedDatetime we get the result (which can contain many pages) ordered by LastModifiedDateTime (ascending) or would it still be ordered by inventoryId?

 

(

The point is that we already try to filter by lastmodifiedDateTime. But we have still so many result-pages that we decided to process it page by page to avoid timeout-conflicts.

That means that we take only the first page from the result and finish the processing. We save the max LastModifiedDateTime from the first page. And than we run a new thread using this value as filter, process the first page again, save the max lastmodified and so on - until we don't get any more pages. 

)

Yıldırım
VISMA

by Yıldırım

@Florian Haase wrote:

Yes, we are aware of that, but do I understand you right: If we use the filter on LastModifiedDatetime we get the result (which can contain many pages) ordered by LastModifiedDateTime (ascending) or would it still be ordered by inventoryId?


Yes, to be able to sort the data based on "LastModifiedDateTime" you should use LastModifiedDateTime & LastModifiedDatetimeCondition query parameters together with the pagination in the GET request. 

Accepted solution
Magnus Johnsen
VISMA

Hi,

The result should be sorted ascending on lastModifieDateTime.

Florian Haase
PARTNER

Thank you, thats great.