How to retrieve daml contracts from fabric ledger, according to time?

I want to fetch daml contracts that I stored in ledger according to Time (Data Type in DAML).

Ex :-
This is how, the query looks when I am creating my contract :-

{
    "templateId": "Example",
    "payload": {
        "updatedDate": "2015-12-05T11:15:31Z"
    }
}


For retrieving, my query is ;- 

{
    "templateIds": [
        "Example"
    ],
    "query": {

    }
}

In this was it return all the contracts, with the first one being the contract, that is created earlier according to time…

How should I retrieve in a way where the contract I have created latest, should come first?

1 Like

The HTTP JSON API query language does not implement ordering at the moment, you would have to fetch the active contracts and sort them on your end before serving them.

1 Like